diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-25 15:45:10 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-25 15:45:10 +0400 |
commit | 1cb4c2d898b531c5d325dcc035fc1e9c22ca93a4 (patch) | |
tree | fcb101cfcd335be2597efc9c90408162c0487f83 /src/fuzzy.c | |
parent | 9afab53b6b0e7d70da06c92e8890366dfc80481c (diff) | |
download | rspamd-1cb4c2d898b531c5d325dcc035fc1e9c22ca93a4.tar.gz rspamd-1cb4c2d898b531c5d325dcc035fc1e9c22ca93a4.zip |
Fix coredumps when learning message with one empty part.
Diffstat (limited to 'src/fuzzy.c')
-rw-r--r-- | src/fuzzy.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/fuzzy.c b/src/fuzzy.c index 55ed6b9ff..dba76fe69 100644 --- a/src/fuzzy.c +++ b/src/fuzzy.c @@ -478,14 +478,16 @@ fuzzy_compare_hashes (fuzzy_hash_t * h1, fuzzy_hash_t * h2) gint fuzzy_compare_parts (struct mime_text_part *p1, struct mime_text_part *p2) { - if (p1->fuzzy->block_size == p2->fuzzy->block_size) { - return fuzzy_compare_hashes (p1->fuzzy, p2->fuzzy); - } - else if (p1->double_fuzzy->block_size == p2->fuzzy->block_size) { - return fuzzy_compare_hashes (p1->double_fuzzy, p2->fuzzy); - } - else if (p2->double_fuzzy->block_size == p1->fuzzy->block_size) { - return fuzzy_compare_hashes (p2->double_fuzzy, p1->fuzzy); + if (p1->fuzzy != NULL && p2->fuzzy != NULL) { + if (p1->fuzzy->block_size == p2->fuzzy->block_size) { + return fuzzy_compare_hashes (p1->fuzzy, p2->fuzzy); + } + else if (p1->double_fuzzy->block_size == p2->fuzzy->block_size) { + return fuzzy_compare_hashes (p1->double_fuzzy, p2->fuzzy); + } + else if (p2->double_fuzzy->block_size == p1->fuzzy->block_size) { + return fuzzy_compare_hashes (p2->double_fuzzy, p1->fuzzy); + } } return 0; |