aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-04 14:40:13 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-04 14:40:13 +0100
commit6f1d2064568e8bd3840cd6300608f22c75c4ea80 (patch)
treeac7fddcf019fda766f088875ccba521d8a86f25f /src/libutil
parentd73636e6823fc1971256858a848fa75d0402689d (diff)
downloadrspamd-6f1d2064568e8bd3840cd6300608f22c75c4ea80.tar.gz
rspamd-6f1d2064568e8bd3840cd6300608f22c75c4ea80.zip
[Minor] Fix out-of-bound read
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/shingles.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libutil/shingles.c b/src/libutil/shingles.c
index 73fa04ea1..3e0c14b3a 100644
--- a/src/libutil/shingles.c
+++ b/src/libutil/shingles.c
@@ -89,7 +89,6 @@ rspamd_shingles_get_keys_cached (const guchar key[SHINGLES_KEY_SIZE])
/* Generate keys */
rspamd_cryptobox_hash_init (&bs, NULL, 0);
cur_key = key;
- out_key = keys[0];
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
/*
@@ -97,13 +96,13 @@ rspamd_shingles_get_keys_cached (const guchar key[SHINGLES_KEY_SIZE])
* initial key as many times as many hashes are required and
* xor left and right parts of sha256 to get a single 16 bytes SIP key.
*/
+ out_key = keys[i];
rspamd_cryptobox_hash_update (&bs, cur_key, 16);
rspamd_cryptobox_hash_final (&bs, shabuf);
memcpy (out_key, shabuf, 16);
rspamd_cryptobox_hash_init (&bs, NULL, 0);
cur_key = out_key;
- out_key = keys[i + 1];
}
g_hash_table_insert (ht, key_cpy, keys);