From 0227d24a1e114bfd458bfcf66776556f579ad140 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 6 Jul 2015 16:00:48 +0100 Subject: [PATCH] Do not dereference null pointer on learning. --- src/libstat/learn_cache/sqlite3_cache.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libstat/learn_cache/sqlite3_cache.c b/src/libstat/learn_cache/sqlite3_cache.c index d8c904d90..017ee6108 100644 --- a/src/libstat/learn_cache/sqlite3_cache.c +++ b/src/libstat/learn_cache/sqlite3_cache.c @@ -202,9 +202,11 @@ rspamd_stat_cache_sqlite3_process (struct rspamd_task *task, while (cur) { part = (struct mime_text_part *)cur->data; - for (i = 0; i < part->words->len; i ++) { - word = &g_array_index (part->words, rspamd_fstring_t, i); - blake2b_update (&st, word->begin, word->len); + if (part->words != NULL) { + for (i = 0; i < part->words->len; i ++) { + word = &g_array_index (part->words, rspamd_fstring_t, i); + blake2b_update (&st, word->begin, word->len); + } } cur = g_list_next (cur); -- 2.39.5