]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix issue with zero length atoms
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 4 Dec 2015 16:26:32 +0000 (16:26 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 4 Dec 2015 16:26:32 +0000 (16:26 +0000)
src/libutil/expression.c

index 2f05c98a3ec5dec7d9e5294a1d91db7b0d1aab7d..90be6ae3f4ba35750dd5db2e2e0fad560a4cc686 100644 (file)
@@ -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 */