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

Conversation

keentux
Copy link
Contributor

@keentux keentux commented Aug 6, 2024

Fix the #164 where extra_ptr could be alocated without enough bytes to check the magic value.

Indeed, ZZIP_EXTRA_ZIP64_CHECK, or later in the code, will call ZZIP_GETEXTRA() where it get 2 first bytes to check the magic number.
However, there is not any verification about the size allocated for extras_ptr, where by the value of u_extras, extras_ptr could be allocated of 1 byte (what happened with the provided POC in the bug description). We should be sure that u_extra allocates the extras_ptr with more that 2 bytes, or better, at least same value of the size of the zzip_extra_zip64 struct.

* Fix the issue gdraheim#164 where extra_ptr could be alocated without enough
  bytes to check the magic value.

Signed-off-by: vlefebvre <valentin.lefebvre@suse.com>
@keentux keentux force-pushed the parse-root-dir-extra branch from 706c502 to 550e30e Compare August 6, 2024 16:02
@keentux
Copy link
Contributor Author

keentux commented Aug 6, 2024

Also fix issue #166

@gdraheim gdraheim merged commit 3a1a0f8 into gdraheim:develop Aug 6, 2024
3 of 4 checks passed
gdraheim added a commit that referenced this pull request Aug 8, 2024
@gdraheim
Copy link
Owner

gdraheim commented Aug 8, 2024

Some tests failed and showed that there are zip files around that do not encode the full ZIP64 entries block.

@keentux
Copy link
Contributor Author

keentux commented Aug 9, 2024

Oh, Thanks for the verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants