]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Do not crash on empty subtype
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 10 Feb 2018 15:29:29 +0000 (15:29 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 10 Feb 2018 15:29:29 +0000 (15:29 +0000)
MFH: rspamd-1.6

src/plugins/fuzzy_check.c

index 02e8701904080bd34c9ac0c930a05bd230a87518..90f04e0591044913e500a5765c1b5cfa299fe7c4 100644 (file)
@@ -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;
                                        }
                                }