aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-04 10:06:24 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-04 10:06:24 +0100
commite658c7fcb5d275f144954b9cea1c34fadfa81902 (patch)
tree87ae0237205cae12e57ce45b7acbe3fab6d11229 /src/libmime
parent6dbf2e4e35b7be68774ae4a87e582742cb1258f5 (diff)
downloadrspamd-e658c7fcb5d275f144954b9cea1c34fadfa81902.tar.gz
rspamd-e658c7fcb5d275f144954b9cea1c34fadfa81902.zip
[Fix] Escape utf in regexp to dodge ragel/hyperscan issue
Diffstat (limited to 'src/libmime')
-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 7a0c27f1b..89111743b 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -491,9 +491,14 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line,
dend = result->regexp_text + (end - start);
*dend = '\0';
- result->regexp = rspamd_regexp_new (dbegin, re_flags->str,
+ gsize esc_len;
+ gchar *escaped = rspamd_str_regexp_escape (dbegin, dend - dbegin, &esc_len,
+ RSPAMD_REGEXP_ESCAPE_UTF);
+
+ result->regexp = rspamd_regexp_new (escaped, re_flags->str,
&err);
+ g_free (escaped);
g_string_free (re_flags, TRUE);
if (result->regexp == NULL || err != NULL) {