aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-02-22 20:54:34 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:37 +0800
commit410dbf8e7ab784df090650104d3e2334487c110e (patch)
treea8104faa96594606b81f596342bb696f37beed36
parent2df4eb2b0c7aa84ac41738a059894b91d79cfc8a (diff)
downloadgsoc2013-evolution-410dbf8e7ab784df090650104d3e2334487c110e.tar.gz
gsoc2013-evolution-410dbf8e7ab784df090650104d3e2334487c110e.tar.zst
gsoc2013-evolution-410dbf8e7ab784df090650104d3e2334487c110e.zip
Bug #608804 - Some attachments make evolution crash in libical
-rw-r--r--modules/calendar/e-cal-attachment-handler.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index 8fea91ffeb..dfc8f58c34 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -83,7 +83,19 @@ attachment_handler_get_component (EAttachment *attachment)
camel_data_wrapper_decode_to_stream_sync (wrapper, stream, NULL, NULL);
g_object_unref (stream);
- component = e_cal_util_parse_ics_string ((gchar *) buffer->data);
+ if (buffer->len > 0) {
+ const gchar *str;
+
+ /* ensure string being null-terminated */
+ g_byte_array_append (buffer, (const guint8 *) "", 1);
+
+ str = (const gchar *) buffer->data;
+ while (*str && g_ascii_isspace (*str))
+ str++;
+
+ if (g_ascii_strncasecmp (str, "BEGIN:", 6) == 0)
+ component = e_cal_util_parse_ics_string (str);
+ }
g_byte_array_free (buffer, TRUE);