commit 39108d6: [Minor] Fuzzy_check: Fix issue when cached element has no shingles

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 4 10:42:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-02-04 10:40:58 +0000
URL: https://github.com/rspamd/rspamd/commit/39108d6c752bfc582da88b7d29de95d73129dc0e (HEAD -> master)

[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 6b0843948..7edb0168d 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));


More information about the Commits mailing list