aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-22 13:29:50 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-22 13:29:50 +0100
commitcb9f7934192eb974d287581d4ff997e3b1a25716 (patch)
treefab39cd11af36592dc8d14c3f637f868d2274e3b /src/libmime
parent62c5109fb1dd650531b09440add5481a27cad8cb (diff)
downloadrspamd-cb9f7934192eb974d287581d4ff997e3b1a25716.tar.gz
rspamd-cb9f7934192eb974d287581d4ff997e3b1a25716.zip
[Fix] Fix long regexp flags (e.g. {sa_body})
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/mime_expressions.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index 335346e89..647e43f0e 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -373,6 +373,8 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line,
/* Long definition */
if ((brace = strchr (p + 1, '}')) != NULL) {
if (!rspamd_parse_long_option (p + 1, brace - (p + 1), result)) {
+ msg_warn_pool ("invalid long regexp type: %*s in '%s'",
+ (int)(brace - (p + 1)), p + 1, src);
p = NULL;
}
else {
@@ -586,6 +588,7 @@ rspamd_mime_expr_parse (const gchar *line, gsize len,
got_backslash,
got_second_slash,
in_flags,
+ in_flags_brace,
got_obrace,
in_function,
got_ebrace,
@@ -638,13 +641,23 @@ rspamd_mime_expr_parse (const gchar *line, gsize len,
state = in_flags;
break;
case in_flags:
- if (!g_ascii_isalpha (t)) {
+ if (t == '{') {
+ state = in_flags_brace;
+ p ++;
+ }
+ else if (!g_ascii_isalpha (t)) {
state = end_atom;
}
else {
p ++;
}
break;
+ case in_flags_brace:
+ if (t == '}') {
+ state = in_flags;
+ }
+ p ++;
+ break;
case got_backslash:
state = prev_state;
p ++;