aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-05 23:17:55 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-05 23:17:55 +0100
commit05500cf6d5c100607f079759fadd1ccfe23a6fa7 (patch)
treed756b3202f7b7e34c18057d8becac8337b536af1 /src/libserver
parent72b02dc59b6bbf886ea1e8a220551bb81feb0728 (diff)
downloadrspamd-05500cf6d5c100607f079759fadd1ccfe23a6fa7.tar.gz
rspamd-05500cf6d5c100607f079759fadd1ccfe23a6fa7.zip
[Fix] Fix extraction of shingles from redis fuzzy storage
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/fuzzy_backend_redis.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libserver/fuzzy_backend_redis.c b/src/libserver/fuzzy_backend_redis.c
index 74d368cb4..f585fa341 100644
--- a/src/libserver/fuzzy_backend_redis.c
+++ b/src/libserver/fuzzy_backend_redis.c
@@ -464,18 +464,19 @@ rspamd_fuzzy_backend_check_shingles (struct rspamd_fuzzy_redis_session *session)
rspamd_fuzzy_redis_session_free_args (session);
/* First of all check digest */
- session->nargs = 2 * session->cmd->shingles_count;
+ session->nargs = session->cmd->shingles_count + 1;
session->argv = g_malloc (sizeof (gchar *) * session->nargs);
session->argv_lens = g_malloc (sizeof (gsize) * session->nargs);
shcmd = (const struct rspamd_fuzzy_shingle_cmd *)session->cmd;
+ session->argv[0] = g_strdup ("MGET");
+ session->argv_lens[0] = 4;
+
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
key = g_string_new (session->backend->redis_object);
rspamd_printf_gstring (key, "_%d_%uL", i, shcmd->sgl.hashes[i]);
- session->argv[i * 2] = g_strdup ("GET");
- session->argv_lens[i * 2] = 3;
- session->argv[i * 2 + 1] = key->str;
- session->argv_lens[i * 2 + 1] = key->len;
+ session->argv[i] = key->str;
+ session->argv_lens[i] = key->len;
g_string_free (key, FALSE); /* Do not free underlying array */
}