aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-26 17:37:34 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-26 17:37:34 +0100
commit309c486ae9bd82bb34190d50a7d86f2a876c868a (patch)
tree847fe8c23741897c6a0ab11d28a555ffab8b04f6
parentf6daeebeea7228060e94d8bc63e4880653792ad1 (diff)
downloadrspamd-309c486ae9bd82bb34190d50a7d86f2a876c868a.tar.gz
rspamd-309c486ae9bd82bb34190d50a7d86f2a876c868a.zip
Do not query empty hashes.
-rw-r--r--src/plugins/fuzzy_check.c12
1 files 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);