Skip to content

fix out-of-bounds read in zip_dir_add for empty name#529

Merged
dillof merged 1 commit into
nih-at:mainfrom
rootvector2:fix-zip-dir-add-empty-name
Jun 3, 2026
Merged

fix out-of-bounds read in zip_dir_add for empty name#529
dillof merged 1 commit into
nih-at:mainfrom
rootvector2:fix-zip-dir-add-empty-name

Conversation

@rootvector2

Copy link
Copy Markdown
Contributor

zip_dir_add() reads name[len - 1] to test for a trailing slash, but len is strlen(name) and is never checked for zero. Passing an empty name makes this name[(size_t)-1], a one-byte out-of-bounds read before the buffer. Guard the access with len == 0 so empty names take the trailing-slash path instead.

@dillof dillof merged commit ea6cd0f into nih-at:main Jun 3, 2026
1 check failed
@dillof

dillof commented Jun 3, 2026

Copy link
Copy Markdown
Member

Another good catch, thanks.

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