]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fuzzy_check: Fix issue when cached element has no shingles
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 Feb 2019 10:40:58 +0000 (10:40 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 Feb 2019 10:40:58 +0000 (10:40 +0000)
Issue: #2742

src/plugins/fuzzy_check.c

index 6b0843948c1537874f535ba97afa1c3265cdaf48..7edb0168df5da99afcde88fccc132591504eeec3 100644 (file)
@@ -1416,7 +1416,7 @@ fuzzy_cmd_from_text_part (struct rspamd_task *task,
                                        sizeof (cached->digest));
                        cmd->shingles_count = 0;
                }
-               else {
+               else if (cached->sh) {
                        encshcmd = rspamd_mempool_alloc0 (pool, sizeof (*encshcmd));
                        shcmd = &encshcmd->cmd;
                        memcpy (&shcmd->sgl, cached->sh, sizeof (struct rspamd_shingle));
@@ -1424,6 +1424,9 @@ fuzzy_cmd_from_text_part (struct rspamd_task *task,
                                        sizeof (cached->digest));
                        shcmd->basic.shingles_count = RSPAMD_SHINGLE_SIZE;
                }
+               else {
+                       return NULL;
+               }
        }
        else {
                cached = rspamd_mempool_alloc (pool, sizeof (*cached));