Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse_root_dir: Verify size of extra obtained #169

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion zzip/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ __zzip_parse_root_directory(int fd, struct _disk_trailer* trailer, struct zzip_d
hdr->d_namlen = u_namlen;

/* looking for ZIP64 extras when csize on intmax */
if (u_extras && (hdr->d_csize & 0xFFFFu == 0xFFFFu)) {
if (u_extras >= __sizeof(struct zzip_extra_zip64) &&
(hdr->d_csize & 0xFFFFu == 0xFFFFu)) {
DBG3("%i extras bytes (%i)", u_extras, sizeof(struct zzip_extra_zip64));
zzip_off64_t zz_extras = zz_offset + sizeof(*d) + u_namlen;
zzip_byte_t* extras_ptr;
Expand Down
Loading