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

miniunz: Ensure filenames read from a ZIP file are always null terminated #911

Closed
wants to merge 1 commit into from

Conversation

zmodem
Copy link
Contributor

@zmodem zmodem commented Jan 23, 2024

unzGetCurrentFileInfo64 does not null terminate the szFileName if it's longer or equal to fileNameBufferSize.

To ensure the strings are null terminated in the calling code, increase the buffer size by one and initialize with zeros.

Fixes #869

@Neustradamus
Copy link

Neustradamus commented Jan 23, 2024

@madler, @gvollant: Can you look this PR?

Linked to:

@madler
Copy link
Owner

madler commented Jan 23, 2024

I fixed it by making the buffers 65537 bytes. The zip file format limits file names to 65536 bytes.

@madler madler closed this Jan 23, 2024
@zmodem
Copy link
Contributor Author

zmodem commented Jan 24, 2024

I fixed it by making the buffers 65537 bytes.

Clever :-)

@Neustradamus
Copy link

Merged commits:

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.

stack buffer overflow in miniunz
3 participants