Skip to content

Commit

Permalink
Do not dereference null pointer on learning.
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Jul 6, 2015
1 parent e8325d3 commit 0227d24
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libstat/learn_cache/sqlite3_cache.c
Expand Up @@ -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);
Expand Down

0 comments on commit 0227d24

Please sign in to comment.