From 98f30961257856c469c4674d966513edabd20286 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 19 Mar 2015 13:13:57 +0000 Subject: [PATCH] Fix parsing of limits. --- src/libutil/expression.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libutil/expression.c b/src/libutil/expression.c index 4b987ccae..2b52e2923 100644 --- a/src/libutil/expression.c +++ b/src/libutil/expression.c @@ -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); -- 2.39.5