diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-03-24 16:00:34 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-03-24 16:03:48 +0000 |
commit | a04efc35197414102796de2ca934c118656f769b (patch) | |
tree | 81407642e46154eb543e51241845e84e94952072 /src | |
parent | b2a7fb247bec2c1374259fd7ab62949c2f19d55e (diff) | |
download | rspamd-a04efc35197414102796de2ca934c118656f769b.tar.gz rspamd-a04efc35197414102796de2ca934c118656f769b.zip |
[Fix] Fix processing of subject words
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/chartable.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c index ff3aa480f..5ff7fc380 100644 --- a/src/plugins/chartable.c +++ b/src/plugins/chartable.c @@ -415,23 +415,23 @@ chartable_symbol_callback (struct rspamd_task *task, void *unused) FALSE, NULL); - if (words) { + if (words && words->len > 0) { for (i = 0; i < words->len; i++) { w = &g_array_index (words, rspamd_stat_token_t, i); cur_score += rspamd_chartable_process_word_utf (task, w, FALSE); } - } - cur_score /= (gdouble)part->normalized_words->len; + cur_score /= (gdouble)words->len; - if (cur_score > 2.0) { - cur_score = 2.0; - } + if (cur_score > 2.0) { + cur_score = 2.0; + } - if (cur_score > chartable_module_ctx->threshold) { - rspamd_task_insert_result (task, chartable_module_ctx->symbol, - cur_score, "subject"); + if (cur_score > chartable_module_ctx->threshold) { + rspamd_task_insert_result (task, chartable_module_ctx->symbol, + cur_score, "subject"); + } } } } |