Skip to content

Commit

Permalink
Zip: prevent possible nullpointer dereference when parsing directory …
Browse files Browse the repository at this point in the history
…entries
  • Loading branch information
selmf committed May 1, 2022
1 parent 22dbd92 commit 02129fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion zip/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ static bool zip_parse_local_entry(ar_archive *ar, off64_t offset)
zip->progress.data_left = (size_t)entry.datasize;
zip_clear_uncompress(&zip->uncomp);

if (entry.datasize == 0 && ar_entry_get_name(ar) && *zip->entry.name && zip->entry.name[strlen(zip->entry.name) - 1] == '/') {
if (entry.datasize == 0 && ar_entry_get_name(ar) &&
zip->entry.name != NULL && *zip->entry.name &&
zip->entry.name[strlen(zip->entry.name) - 1] == '/') {
log("Skipping directory entry \"%s\"", zip->entry.name);
return zip_parse_local_entry(ar, ar->entry_offset_next);
}
Expand Down

0 comments on commit 02129fe

Please sign in to comment.