aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_expressions.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-08 16:28:24 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-08 16:28:24 +0000
commit83deb3e1dd871c984cc4bac4529d8db55202e7d5 (patch)
treed790a6718352b48094203b6429c98dfad49a9da3 /src/libmime/mime_expressions.c
parente1dd956b3c12f1e9146d49f4540b5cac5f720dd9 (diff)
downloadrspamd-83deb3e1dd871c984cc4bac4529d8db55202e7d5.tar.gz
rspamd-83deb3e1dd871c984cc4bac4529d8db55202e7d5.zip
Do not assume invalid header regexps by default
Diffstat (limited to 'src/libmime/mime_expressions.c')
-rw-r--r--src/libmime/mime_expressions.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index 9218b4a02..8d42bf9a8 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -239,7 +239,7 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line)
}
else {
result->header = rspamd_mempool_strdup (pool, line);
- result->type = RSPAMD_RE_HEADER;
+ result->type = RSPAMD_RE_MAX;
line = start;
}
/* Find begin of regexp */
@@ -329,6 +329,11 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line)
}
}
+ if (result->type >= RSPAMD_RE_MAX) {
+ msg_err_pool ("could not read regexp: %s, unknown type", src);
+ return NULL;
+ }
+
result->regexp_text = rspamd_mempool_strdup (pool, start);
dbegin = result->regexp_text + (begin - start);
dend = result->regexp_text + (end - start);