From: Vsevolod Stakhov Date: Fri, 27 Sep 2019 09:47:34 +0000 (+0100) Subject: [Minor] Fix OOB access X-Git-Tag: 2.0~117 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bdcbf7aa2db8dd9acfd8fd1c08b7909de5106760;p=rspamd.git [Minor] Fix OOB access --- diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c index 1153a54c7..1c132335c 100644 --- a/src/libmime/mime_parser.c +++ b/src/libmime/mime_parser.c @@ -927,17 +927,19 @@ rspamd_mime_preprocess_cb (struct rspamd_multipattern *mp, bend ++; } - if (*bend == '\r') { - bend ++; + if (bend < end) { + if (*bend == '\r') { + bend++; - /* \r\n */ - if (*bend == '\n') { - bend ++; + /* \r\n */ + if (*bend == '\n') { + bend++; + } + } + else { + /* \n */ + bend++; } - } - else { - /* \n */ - bend ++; } b.boundary = p - st->start - 2;