From: Vsevolod Stakhov Date: Thu, 26 Mar 2015 13:54:01 +0000 (+0000) Subject: Fix composites processing. X-Git-Tag: 0.9.0~418 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f49870c17049808938ffab9391bcd13bf0a6d098;p=rspamd.git Fix composites processing. --- 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);