diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-27 15:52:28 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-27 15:52:28 +0100 |
commit | dfbcf2c23fba345278eb75b77e64938bec4d439d (patch) | |
tree | 8ddc70961a9ead263dd1e1d4773f00af9493af0c /src/libserver/re_cache.c | |
parent | 3da3ad2506b2326ca533b11b9ab8e2cebb92b63f (diff) | |
download | rspamd-dfbcf2c23fba345278eb75b77e64938bec4d439d.tar.gz rspamd-dfbcf2c23fba345278eb75b77e64938bec4d439d.zip |
[Fix] Do not count images urls when checking url regexps for compatibility
Diffstat (limited to 'src/libserver/re_cache.c')
-rw-r--r-- | src/libserver/re_cache.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 592cc31d4..617322926 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -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", |