]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix long regexp flags (e.g. {sa_body})
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Jul 2016 12:29:50 +0000 (13:29 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Jul 2016 12:29:50 +0000 (13:29 +0100)
src/libmime/mime_expressions.c

index 335346e89326ce1cbc1ba91f02156d94a15bbc0d..647e43f0e7de5ae6427e31bb113f3e6ba0716e45 100644 (file)
@@ -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 ++;