From 309c486ae9bd82bb34190d50a7d86f2a876c868a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 26 Jun 2013 17:37:34 +0100 Subject: [PATCH] Do not query empty hashes. --- src/plugins/fuzzy_check.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index d6393030b..33e710c90 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -650,6 +650,7 @@ fuzzy_symbol_callback (struct worker_task *task, void *unused) struct mime_part *mime_part; struct rspamd_image *image; gchar *checksum; + gsize hashlen; GList *cur; fuzzy_hash_t *fake_fuzzy; @@ -682,8 +683,15 @@ fuzzy_symbol_callback (struct worker_task *task, void *unused) } /* Check length of hash */ - if (fuzzy_module_ctx->min_hash_len != 0 && - strlen (part->fuzzy->hash_pipe) * part->fuzzy->block_size < fuzzy_module_ctx->min_hash_len) { + hashlen = strlen (part->fuzzy->hash_pipe); + if (hashlen == 0) { + msg_info ("<%s>, part hash empty, skip fuzzy check", + task->message_id, fuzzy_module_ctx->min_hash_len); + cur = g_list_next (cur); + continue; + } + if (fuzzy_module_ctx->min_hash_len != 0 && + hashlen * part->fuzzy->block_size < fuzzy_module_ctx->min_hash_len) { msg_info ("<%s>, part hash is shorter than %d symbols, skip fuzzy check", task->message_id, fuzzy_module_ctx->min_hash_len); cur = g_list_next (cur); -- 2.39.5