]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix processing of subject words
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 Mar 2017 16:00:34 +0000 (16:00 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 Mar 2017 16:03:48 +0000 (16:03 +0000)
src/plugins/chartable.c

index ff3aa480f0bce8d80cfd2ce19a538723f2572f2c..5ff7fc380a2887754aff9836b53b58db1509bb6f 100644 (file)
@@ -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");
 
+                       }
                }
        }
 }