commit dfbcf2c: [Fix] Do not count images urls when checking url regexps for compatibility
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Sep 27 14:56:05 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-09-27 15:52:28 +0100
URL: https://github.com/rspamd/rspamd/commit/dfbcf2c23fba345278eb75b77e64938bec4d439d (HEAD -> master)
[Fix] Do not count images urls when checking url regexps for compatibility
---
src/libserver/re_cache.c | 17 +++++++++--------
1 file 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",
More information about the Commits
mailing list