]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do not count images urls when checking url regexps for compatibility
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Sep 2019 14:52:28 +0000 (15:52 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Sep 2019 14:52:28 +0000 (15:52 +0100)
src/libserver/re_cache.c

index 592cc31d4da56cb39f48cd61d25f80e147f4c6bb..61732292614a623ecf49836a118e3b20ec0c0fe5 100644 (file)
@@ -1137,15 +1137,17 @@ rspamd_re_cache_exec_re (struct rspamd_task *task,
                        lenvec = g_malloc (sizeof (*lenvec) * cnt);
                        g_hash_table_iter_init (&it, MESSAGE_FIELD (task, urls));
                        i = 0;
+                       raw = FALSE;
 
                        while (g_hash_table_iter_next (&it, &k, &v)) {
                                url = v;
                                in = url->string;
                                len = url->urllen;
-                               raw = FALSE;
 
-                               scvec[i] = (guchar *)in;
-                               lenvec[i++] = len;
+                               if (len > 0 && !(url->flags & RSPAMD_URL_FLAG_IMAGE)) {
+                                       scvec[i] = (guchar *) in;
+                                       lenvec[i++] = len;
+                               }
                        }
 
                        g_hash_table_iter_init (&it, MESSAGE_FIELD (task, emails));
@@ -1154,14 +1156,13 @@ rspamd_re_cache_exec_re (struct rspamd_task *task,
                                url = v;
                                in = url->string;
                                len = url->urllen;
-                               raw = FALSE;
 
-                               scvec[i] = (guchar *) in;
-                               lenvec[i++] = len;
+                               if (len > 0 && !(url->flags & RSPAMD_URL_FLAG_IMAGE)) {
+                                       scvec[i] = (guchar *) in;
+                                       lenvec[i++] = len;
+                               }
                        }
 
-                       g_assert (i == cnt);
-
                        ret = rspamd_re_cache_process_regexp_data (rt, re,
                                        task, scvec, lenvec, i, raw);
                        msg_debug_re_task ("checking url regexp: %s -> %d",