Skip to content

Commit

Permalink
Add allocation check for the zip_entry struct.
Browse files Browse the repository at this point in the history
  • Loading branch information
Don Meyer committed May 15, 2018
1 parent 6c739e0 commit 1165100
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libarchive/archive_read_support_format_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -2708,6 +2708,11 @@ slurp_central_directory(struct archive_read *a, struct zip *zip)
return ARCHIVE_FATAL;

zip_entry = calloc(1, sizeof(struct zip_entry));
if (zip_entry == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate zip entry");
return ARCHIVE_FATAL;
}
zip_entry->next = zip->zip_entries;
zip_entry->flags |= LA_FROM_CENTRAL_DIRECTORY;
zip->zip_entries = zip_entry;
Expand Down

0 comments on commit 1165100

Please sign in to comment.