]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do not penalize characters just after numeric prefix
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 20 Feb 2017 16:36:42 +0000 (16:36 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 20 Feb 2017 16:41:51 +0000 (16:41 +0000)
Issue: #1435

src/plugins/chartable.c

index 6e55ad358bcfff22f101bd11d6a9d84244b217e9..892815a5ca7a6ce0e34c30b14d28c692bb971f8a 100644 (file)
@@ -271,7 +271,7 @@ rspamd_chartable_process_word_ascii (struct rspamd_task *task,
                ascii = 1,
                non_ascii
        } sc, last_sc;
-       gint same_script_count = 0;
+       gint same_script_count = 0, seen_alpha = FALSE;
        enum {
                start_process = 0,
                got_alpha,
@@ -294,7 +294,7 @@ rspamd_chartable_process_word_ascii (struct rspamd_task *task,
 
                        if (state == got_digit) {
                                /* Penalize digit -> alpha translations */
-                               if (!is_url && !g_ascii_isxdigit (*p)) {
+                               if (seen_alpha && !is_url && !g_ascii_isxdigit (*p)) {
                                        badness += 1.0;
                                }
                        }
@@ -318,6 +318,7 @@ rspamd_chartable_process_word_ascii (struct rspamd_task *task,
                                }
                        }
 
+                       seen_alpha = TRUE;
                        state = got_alpha;
 
                }