]> source.dussan.org Git - rspamd.git/commitdiff
Fix parsing of limits.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 19 Mar 2015 13:13:57 +0000 (13:13 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 19 Mar 2015 13:47:54 +0000 (13:47 +0000)
src/libutil/expression.c

index 4b987ccaec61259b4eff9a9b66d8d4ce597a59e8..2b52e29235b5437a5ad18981fd3f4771a845a293 100644 (file)
@@ -322,7 +322,7 @@ rspamd_parse_expression (const gchar *line, gsize len,
                len = strlen (line);
        }
 
-       num_re = rspamd_regexp_cache_create (NULL, "/^\\d+\\s*[><]/", NULL, NULL);
+       num_re = rspamd_regexp_cache_create (NULL, "/^\\d+(\\s+|$)/", NULL, NULL);
 
        p = line;
        c = line;
@@ -383,10 +383,14 @@ rspamd_parse_expression (const gchar *line, gsize len,
                        }
                        break;
                case PARSE_LIM:
-                       if (g_ascii_isdigit (*p)) {
+                       if (g_ascii_isdigit (*p) && p != end - 1) {
                                p ++;
                        }
                        else {
+                               if (p == end - 1) {
+                                       p ++;
+                               }
+
                                if (p - c > 0) {
                                        elt.type = ELT_LIMIT;
                                        elt.p.lim.val = strtoul (c, NULL, 10);