aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/expression.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-04 16:26:32 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-04 16:26:32 +0000
commit4ec67ca54be51a10a54dbb70433d06a9127ac16c (patch)
tree16b0aa1960423773cf9e946cac3d0cc853acaf2d /src/libutil/expression.c
parentc94582f6eda5f18e3c4ded2ca25e8ff98c9b8064 (diff)
downloadrspamd-4ec67ca54be51a10a54dbb70433d06a9127ac16c.tar.gz
rspamd-4ec67ca54be51a10a54dbb70433d06a9127ac16c.zip
Fix issue with zero length atoms
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 2f05c98a3..90be6ae3f 100644
--- a/src/libutil/expression.c
+++ b/src/libutil/expression.c
@@ -600,11 +600,15 @@ rspamd_parse_expression (const gchar *line, gsize len,
else {
/* Try to parse atom */
atom = subr->parse (p, end - p, pool, subr_data, err);
- if (atom == NULL) {
+ if (atom == NULL || atom->len == 0) {
/* We couldn't parse the atom, so go out */
+ g_set_error (err, rspamd_expr_quark (),
+ 500,
+ "Cannot parse atom: callback function failed"
+ " to parse '%.*s'", (int)(end - p), p);
goto err;
}
- g_assert (atom->len != 0);
+
p = p + atom->len;
/* Push to output */