]> source.dussan.org Git - rspamd.git/commitdiff
Do not query empty hashes.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 26 Jun 2013 16:37:34 +0000 (17:37 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 26 Jun 2013 16:37:34 +0000 (17:37 +0100)
src/plugins/fuzzy_check.c

index d6393030b91052074cc8103c4a2067606254114a..33e710c90260216f368a5d67b41f959b6043c8ba 100644 (file)
@@ -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);