From 65f8d2660f3186f218d16624053a47a9933cadb6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 12 Nov 2018 13:45:04 +0000 Subject: [Fix] Ignore signatures when looking for boundaries --- src/libmime/mime_parser.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c index 37b312f44..9ce39ad16 100644 --- a/src/libmime/mime_parser.c +++ b/src/libmime/mime_parser.c @@ -871,10 +871,25 @@ rspamd_mime_preprocess_cb (struct rspamd_multipattern *mp, task = st->task; if (G_LIKELY (p < end)) { - blen = rspamd_memcspn (p, "\r\n", end - p); + gboolean seen_non_dash = FALSE; - if (blen > 0) { + blen = 0; + + while (p < end) { + if (*p == '\r' || *p == '\n') { + break; + } + else if (*p != '-') { + seen_non_dash = TRUE; + } + + blen ++; + p ++; + } + + if (blen > 0 && seen_non_dash) { /* We have found something like boundary */ + p = text + match_pos; bend = p + blen - 1; if (*bend == '-') { -- cgit v1.2.3