From c4cac6d1f2a79b8da49affe48da1494c0247fde3 Mon Sep 17 00:00:00 2001 From: Vivek Jain Date: Thu, 28 Jul 2005 04:45:56 +0000 Subject: applied patch submitted by do not send "cid:" to 2005-07-27 Vivek Jain * itip-formatter.c : (update_item) applied patch submitted by do not send "cid:" to get the part. check part for NULL before using it. (message_foreach_part): do nothing if part is NULL saves crash. **Fixes #272632 svn path=/trunk/; revision=29908 --- plugins/itip-formatter/itip-formatter.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'plugins/itip-formatter/itip-formatter.c') diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index a090e33025..00c62bb325 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -666,6 +666,9 @@ message_foreach_part (CamelMimePart *part, GSList **part_list) int parts, i; int go = TRUE; + if (!part) + return; + *part_list = g_slist_append (*part_list, part); containee = camel_medium_get_content_object (CAMEL_MEDIUM (part)); @@ -738,26 +741,29 @@ update_item (FormatItipPObject *pitip, ItipViewResponse response) if (!g_ascii_strncasecmp (uri, "cid:...", 7)) { message_foreach_part ((CamelMimePart *) msg, &parts); - + for (m = parts; m; m = m->next) { part = m->data; - + /* Skip the actual message and the text/calendar part */ /* FIXME Do we need to skip anything else? */ if (part == (CamelMimePart *) msg || part == pitip->pobject.part) continue; - + new_uri = em_utils_temp_save_part (NULL, part); g_message ("DEBUG: the uri obtained was %s\n", new_uri); new_attachments = g_slist_append (new_attachments, new_uri); } - + g_slist_free (parts); - + } else if (!g_ascii_strncasecmp (uri, "cid:", 4)) { - part = camel_mime_message_get_part_by_content_id (msg, uri); - new_uri = em_utils_temp_save_part (NULL, part); - new_attachments = g_slist_append (new_attachments, new_uri); + part = camel_mime_message_get_part_by_content_id (msg, uri + 4); + if (part) { + new_uri = em_utils_temp_save_part (NULL, part); + new_attachments = g_slist_append (new_attachments, new_uri); + } + } else { /* Preserve existing non-cid ones */ new_attachments = g_slist_append (new_attachments, g_strdup (uri)); -- cgit