From: Vsevolod Stakhov Date: Thu, 30 Jul 2009 13:00:54 +0000 (+0400) Subject: * Fix some issues with empty parts X-Git-Tag: 0.2.7~60 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e7f2df7d45962a98f5caeb5c664fc6c1310f3112;p=rspamd.git * Fix some issues with empty parts --- diff --git a/src/message.c b/src/message.c index dce8473e1..643ac1710 100644 --- a/src/message.c +++ b/src/message.c @@ -511,7 +511,7 @@ process_text_part (struct worker_task *task, GByteArray *part_content, GMimeCont if (g_mime_content_type_is_type (type, "text", "html") || g_mime_content_type_is_type (type, "text", "xhtml")) { msg_debug ("mime_foreach_callback: got urls from text/html part"); - text_part = memory_pool_alloc (task->task_pool, sizeof (struct mime_text_part)); + text_part = memory_pool_alloc0 (task->task_pool, sizeof (struct mime_text_part)); text_part->is_html = TRUE; if (is_empty) { text_part->is_empty = TRUE; @@ -547,7 +547,7 @@ process_text_part (struct worker_task *task, GByteArray *part_content, GMimeCont else if (g_mime_content_type_is_type (type, "text", "plain")) { msg_debug ("mime_foreach_callback: got urls from text/plain part"); - text_part = memory_pool_alloc (task->task_pool, sizeof (struct mime_text_part)); + text_part = memory_pool_alloc0 (task->task_pool, sizeof (struct mime_text_part)); text_part->is_html = FALSE; if (is_empty) { text_part->is_empty = TRUE; diff --git a/src/plugins/emails.c b/src/plugins/emails.c index 719350e05..39415f0c8 100644 --- a/src/plugins/emails.c +++ b/src/plugins/emails.c @@ -147,6 +147,11 @@ extract_emails (struct worker_task *task) while (cur) { part = cur->data; + if (part->is_empty) { + cur = g_list_next (cur); + continue; + } + rc = g_regex_match_full (email_module_ctx->email_re, (const char *)part->orig->data, part->orig->len, 0, 0, &info, &err); if (rc) { while (g_match_info_matches (info)) {