aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-02-22 20:54:34 +0800
committerMilan Crha <mcrha@redhat.com>2011-02-22 20:54:34 +0800
commit3c516cb10a9ec929143b7b806bcdc5be491c0924 (patch)
tree8524c1d08bfb7f2a4f9ffd13c426a660e6b28e38 /modules/calendar
parent7745ae29860377c3b44b47ed3929b7a881d10fe7 (diff)
downloadgsoc2013-evolution-3c516cb10a9ec929143b7b806bcdc5be491c0924.tar
gsoc2013-evolution-3c516cb10a9ec929143b7b806bcdc5be491c0924.tar.gz
gsoc2013-evolution-3c516cb10a9ec929143b7b806bcdc5be491c0924.tar.bz2
gsoc2013-evolution-3c516cb10a9ec929143b7b806bcdc5be491c0924.tar.lz
gsoc2013-evolution-3c516cb10a9ec929143b7b806bcdc5be491c0924.tar.xz
gsoc2013-evolution-3c516cb10a9ec929143b7b806bcdc5be491c0924.tar.zst
gsoc2013-evolution-3c516cb10a9ec929143b7b806bcdc5be491c0924.zip
Bug #608804 - Some attachments make evolution crash in libical
Diffstat (limited to 'modules/calendar')
-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);