summaryrefslogtreecommitdiffstats
path: root/src/libutil/expression.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-19 13:13:57 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-19 13:47:54 +0000
commit98f30961257856c469c4674d966513edabd20286 (patch)
treefd4d962ccafe08bdf1af80cdebf2d880f5cbd91d /src/libutil/expression.c
parent448eee861df91ecc2c7a505f2463d03cf1112fef (diff)
downloadrspamd-98f30961257856c469c4674d966513edabd20286.tar.gz
rspamd-98f30961257856c469c4674d966513edabd20286.zip
Fix parsing of limits.
Diffstat (limited to 'src/libutil/expression.c')
-rw-r--r--src/libutil/expression.c8
1 files 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);