From: Vsevolod Stakhov Date: Thu, 19 Mar 2015 13:13:57 +0000 (+0000) Subject: Fix parsing of limits. X-Git-Tag: 0.9.0~461 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=98f30961257856c469c4674d966513edabd20286;p=rspamd.git Fix parsing of limits. --- 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);