diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-10 16:27:11 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-10 16:27:11 +0100 |
commit | d96c3b80561784386ba83f1421f091a65a8341ab (patch) | |
tree | e8cc2782f2ee20d62fd5ed77d9e78f89ee8041e6 /src | |
parent | 62cc91ffb8af40cca3dc82037d87bab8ff270524 (diff) | |
download | rspamd-d96c3b80561784386ba83f1421f091a65a8341ab.tar.gz rspamd-d96c3b80561784386ba83f1421f091a65a8341ab.zip |
[CritFix] Fix levenshtein distance calculations
Diffstat (limited to 'src')
-rw-r--r-- | src/libmime/message.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c index 6c4004f61..4877fde9f 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -1094,7 +1094,7 @@ rspamd_words_levenshtein_distance (struct rspamd_task *task, { guint s1len, s2len, x, y, lastdiag, olddiag; guint *column, ret; - guint64 *h1, *h2; + guint64 h1, h2; gint eq; static const guint max_words = 8192; @@ -1118,9 +1118,9 @@ rspamd_words_levenshtein_distance (struct rspamd_task *task, for (y = 1, lastdiag = x - 1; y <= s1len; y++) { olddiag = column[y]; - h1 = &g_array_index (w1, guint64, y - 1); - h2 = &g_array_index (w2, guint64, x - 1); - eq = h1 == h2; + h1 = g_array_index (w1, guint64, y - 1); + h2 = g_array_index (w2, guint64, x - 1); + eq = (h1 == h2) ? 1 : 0; /* * Cost of replacement is twice higher than cost of add/delete * to calculate percentage properly |