From: Vsevolod Stakhov Date: Mon, 4 Feb 2019 10:40:58 +0000 (+0000) Subject: [Minor] Fuzzy_check: Fix issue when cached element has no shingles X-Git-Tag: 1.9.0~222 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=39108d6c752bfc582da88b7d29de95d73129dc0e;p=thirdparty%2Frspamd.git [Minor] Fuzzy_check: Fix issue when cached element has no shingles Issue: #2742 --- 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));