]> source.dussan.org Git - rspamd.git/commitdiff
* Fix some issues with empty parts
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 30 Jul 2009 13:00:54 +0000 (17:00 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 30 Jul 2009 13:00:54 +0000 (17:00 +0400)
src/message.c
src/plugins/emails.c

index dce8473e18de74ef4d615ac1e6001414f4e3d024..643ac1710dbded2c171f475d2cd2059cc9af3473 100644 (file)
@@ -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;
index 719350e05ec4e356e74ed27adb916be741aa9e84..39415f0c8b312429e4c4aaf26bc98988bcabf699 100644 (file)
@@ -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)) {