Skip to content

lib-index: mail-index-sync-ext - Fix offset overflow in ext header update - #303

Open
nishat-06 wants to merge 1 commit into
dovecot:mainfrom
nishat-06:ext-hdr-update-offset-overflow
Open

lib-index: mail-index-sync-ext - Fix offset overflow in ext header update#303
nishat-06 wants to merge 1 commit into
dovecot:mainfrom
nishat-06:ext-hdr-update-offset-overflow

Conversation

@nishat-06

Copy link
Copy Markdown
Contributor

mail_index_sync_ext_hdr_update() checks offset + size > ext->hdr_size, but both offset and size are uint32_t read from a transaction log ext-header-update32 record, so the sum wraps for a large offset and the check passes. The buffer_write() at ext->hdr_offset + offset then also wraps and writes the record data outside the extension's own header area in hdr_copy_buf. This checks offset and size separately so the comparison can't overflow, and adds a regression test.

…date

offset and size come from a transaction log ext-header-update32 record and are uint32_t, so offset + size > ext->hdr_size wraps for a large offset and passes. The following buffer_write() at ext->hdr_offset + offset then writes the record data outside the extension's header area. Check offset and size separately so the comparison can't overflow.
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.

1 participant