From 39108d6c752bfc582da88b7d29de95d73129dc0e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 4 Feb 2019 10:40:58 +0000 Subject: [PATCH] [Minor] Fuzzy_check: Fix issue when cached element has no shingles Issue: #2742 --- src/plugins/fuzzy_check.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 6b0843948c..7edb0168df 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -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)); -- 2.47.3