From f49870c17049808938ffab9391bcd13bf0a6d098 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 26 Mar 2015 13:54:01 +0000 Subject: [PATCH] Fix composites processing. --- src/libmime/filter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libmime/filter.c b/src/libmime/filter.c index 00cd7396e..43e8e1b2d 100644 --- a/src/libmime/filter.c +++ b/src/libmime/filter.c @@ -445,7 +445,8 @@ rspamd_composite_expr_parse (const gchar *line, gsize len, res = rspamd_mempool_alloc0 (pool, sizeof (*res)); res->len = clen; res->str = line; - res->data = rspamd_mempool_strdup (pool, line); + res->data = rspamd_mempool_alloc (pool, clen + 1); + rspamd_strlcpy (res->data, line, clen + 1); return res; } @@ -453,7 +454,7 @@ static gint rspamd_composite_expr_process (gpointer input, rspamd_expression_atom_t *atom) { struct composites_data *cd = (struct composites_data *)input; - const gchar *sym = atom->str; + const gchar *sym = atom->data; struct rspamd_composite *ncomp; struct symbol_remove_data *rd; struct symbol *ms; @@ -560,9 +561,11 @@ composites_foreach_callback (gpointer key, gpointer value, void *data) /* Checked bit */ setbit (cd->checked, comp->id * 2); + /* Result bit */ if (rc) { setbit (cd->checked, comp->id * 2 + 1); + rspamd_task_insert_result_single (cd->task, key, 1.0, NULL); } else { clrbit (cd->checked, comp->id * 2 + 1); -- 2.39.5