]> source.dussan.org Git - rspamd.git/commitdiff
Do not dereference null pointer on learning.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 6 Jul 2015 15:00:48 +0000 (16:00 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 6 Jul 2015 15:01:37 +0000 (16:01 +0100)
src/libstat/learn_cache/sqlite3_cache.c

index d8c904d904dbc24c912720c793ee0ba78d8f51b5..017ee61088d96b6c039f3947d73f8d836109e2cf 100644 (file)
@@ -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);