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

Buffer overrun when deleting file from archive #106

Closed
abbeycode opened this issue Mar 14, 2021 · 0 comments · Fixed by #108
Closed

Buffer overrun when deleting file from archive #106

abbeycode opened this issue Mar 14, 2021 · 0 comments · Fixed by #108
Assignees
Labels
Milestone

Comments

@abbeycode
Copy link
Owner

The overrun occurs on line 1100 of zip.c when running -[UZKArchive deleteFile:error:]:

size_comment = (uInt)strlen(comment);

You can get the exact stack trace by running the DeleteFileTests unit tests with the Address Sanitizer turned on. It looks like this happens for any file in an archive with no comment, because on line 1464 of UZKArchive it's allocating a zero-length buffer when there's no comment:

char *commentBuffer = (char*)malloc(unzipInfo.size_file_comment);

It should instead make the buffer NULL in that case.

Consider, in order to avoid any future errors like this that Xcode's capable of detecting, making a test plan that runs tests with each of the sanitizers turned on.

@abbeycode abbeycode added the bug label Mar 14, 2021
@abbeycode abbeycode added this to the v2.0 milestone Mar 14, 2021
@abbeycode abbeycode self-assigned this Mar 14, 2021
@abbeycode abbeycode mentioned this issue Mar 14, 2021
@abbeycode abbeycode linked a pull request Mar 14, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant