From 526f5af316b69d5101a56a3ca29eba48f5b10cb0 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 10 Feb 2018 15:29:29 +0000 Subject: [PATCH] [Fix] Do not crash on empty subtype MFH: rspamd-1.6 --- src/plugins/fuzzy_check.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 02e870190..90f04e059 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -331,11 +331,17 @@ fuzzy_check_content_type (struct fuzzy_rule *rule, struct rspamd_content_type *c PTR_ARRAY_FOREACH (rule->mime_types, i, ft) { if (ft->type_re) { - if (rspamd_regexp_match (ft->type_re, ct->type.begin, ct->type.len, - TRUE)) { + if (ct->type.len > 0 && + rspamd_regexp_match (ft->type_re, + ct->type.begin, + ct->type.len, + TRUE)) { if (ft->subtype_re) { - if (rspamd_regexp_match (ft->subtype_re, ct->subtype.begin, - ct->subtype.len, TRUE)) { + if (ct->subtype.len > 0 && + rspamd_regexp_match (ft->subtype_re, + ct->subtype.begin, + ct->subtype.len, + TRUE)) { return TRUE; } } -- 2.39.5