From: Vsevolod Stakhov Date: Wed, 26 Jun 2013 16:37:34 +0000 (+0100) Subject: Do not query empty hashes. X-Git-Tag: 0.6.0~272 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=309c486ae9bd82bb34190d50a7d86f2a876c868a;p=thirdparty%2Frspamd.git Do not query empty hashes. --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index d6393030b9..33e710c902 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);