From: Vsevolod Stakhov Date: Fri, 4 Dec 2015 16:26:32 +0000 (+0000) Subject: Fix issue with zero length atoms X-Git-Tag: 1.1.0~411 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ec67ca54be51a10a54dbb70433d06a9127ac16c;p=thirdparty%2Frspamd.git Fix issue with zero length atoms --- diff --git a/src/libutil/expression.c b/src/libutil/expression.c index 2f05c98a3e..90be6ae3f4 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 */