Skip to content

lib-index: mail-cache-lookup - Fix OOB read of unterminated header - #307

Open
nishat-06 wants to merge 1 commit into
dovecot:mainfrom
nishat-06:mail-cache-header-terminator
Open

lib-index: mail-cache-lookup - Fix OOB read of unterminated header#307
nishat-06 wants to merge 1 commit into
dovecot:mainfrom
nishat-06:mail-cache-header-terminator

Conversation

@nishat-06

Copy link
Copy Markdown
Contributor

header_lines_save() scans a cached header field's leading uint32 line numbers for the 0 terminator and then copies the header text that follows from pos = (lines_count+1)*4. A corrupted dovecot.index.cache field whose size is not a multiple of 4 and that never contains the terminator makes pos run past field->size, so the following memcpy reads a few bytes beyond the field. Bail out and flag the cache corrupted when the terminator is missing, before computing that offset.

header_lines_save() scans a cached header field's leading uint32 line numbers for the 0 terminator and then copies the header text that follows from pos = (lines_count+1)*4. A corrupted dovecot.index.cache field whose size is not a multiple of 4 and that never contains the terminator makes pos run past field->size, so the following memcpy reads a few bytes beyond the field. Bail out and flag the cache corrupted when the terminator is missing.
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