]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Minor] str_util: fix lookahead over-read in find_eoh
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 20 May 2026 13:00:25 +0000 (14:00 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 20 May 2026 13:00:25 +0000 (14:00 +0100)
commit31b1d9955e2233b4705d486d38284d132ad2bd89
treee8936e20cc5a24dfbb91ec049843e96f8410ab44
parentd9c12889c58407fdc91080451bc30f8713e2dccc
[Minor] str_util: fix lookahead over-read in find_eoh

rspamd_string_find_eoh peeks p[1] in the got_cr state but guarded it
with "p < end", which is already guaranteed by the loop and does not
cover the p+1 access. On input whose header region ends with \r\r the
peek read one byte past the buffer; the MIME parser calls this with a
non-NUL-terminated GString view over the message, so that byte is not
guaranteed to exist.

Check p + 1 < end instead; a truncated \r\r at end of input then
falls through to the existing branch that treats it as end-of-headers.
src/libutil/str_util.c