]> 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)
committerAndrew Lewis <nerf@judo.za.org>
Sat, 10 Feb 2018 17:09:44 +0000 (19:09 +0200)
MFH: rspamd-1.6

src/plugins/fuzzy_check.c

index 5df59e1fe19a0be87fad585bd902b066590f476e..61387794837ba4707e6fdbf972ea5d3908739d17 100644 (file)
@@ -314,11 +314,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;
                                        }
                                }