diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-02-10 15:29:29 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-02-10 15:29:29 +0000 |
commit | 526f5af316b69d5101a56a3ca29eba48f5b10cb0 (patch) | |
tree | 6a613eb7128c353e75240d98768f8ec1b7aa31e3 /src | |
parent | 76afba6b433236cefd224d862fc6dc47bc26a5b6 (diff) | |
download | rspamd-526f5af316b69d5101a56a3ca29eba48f5b10cb0.tar.gz rspamd-526f5af316b69d5101a56a3ca29eba48f5b10cb0.zip |
[Fix] Do not crash on empty subtype
MFH: rspamd-1.6
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/fuzzy_check.c | 14 |
1 files 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; } } |