From cc36c9e94b102d12a0a40f37fd0d996c3988d48a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 30 Dec 2014 13:44:57 +0000 Subject: [PATCH] Do not tokenize empty input. --- src/libmime/filter.c | 5 ++++- src/tokenizers/osb.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libmime/filter.c b/src/libmime/filter.c index 467f30b9c..a1f042aae 100644 --- a/src/libmime/filter.c +++ b/src/libmime/filter.c @@ -801,7 +801,10 @@ classifiers_callback (gpointer value, void *arg) } cur = g_list_next (cur); } - g_hash_table_insert (task->tokens, cl->tokenizer, tokens); + + if (tokens != NULL) { + g_hash_table_insert (task->tokens, cl->tokenizer, tokens); + } } /* Take care of subject */ diff --git a/src/tokenizers/osb.c b/src/tokenizers/osb.c index b879237c4..9dd12a8dd 100644 --- a/src/tokenizers/osb.c +++ b/src/tokenizers/osb.c @@ -49,6 +49,10 @@ osb_tokenize_text (struct tokenizer *tokenizer, gint i, processed = 0; guint w; + if (input == NULL) { + return FALSE; + } + if (*tree == NULL) { *tree = g_tree_new (token_node_compare_func); rspamd_mempool_add_destructor (pool, -- 2.39.5