From: Vsevolod Stakhov Date: Sat, 10 Feb 2018 15:29:29 +0000 (+0000) Subject: [Fix] Do not crash on empty subtype X-Git-Tag: 1.7.0~211 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=526f5af316b69d5101a56a3ca29eba48f5b10cb0;p=thirdparty%2Frspamd.git [Fix] Do not crash on empty subtype MFH: rspamd-1.6 --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 02e8701904..90f04e0591 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; } }