[evolution-ews/gnome-3-26] [ECalBackendEws] Prevent crash when item has no MIME content set
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/gnome-3-26] [ECalBackendEws] Prevent crash when item has no MIME content set
- Date: Tue, 14 Nov 2017 11:43:20 +0000 (UTC)
commit e7e4bfd22d3cbe3efc1f504cabab63fb8bc9aadd
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 14 12:38:38 2017 +0100
[ECalBackendEws] Prevent crash when item has no MIME content set
There could happen that the item on the server didn't have set any MIME
content, in which case the code could dereference a NULL pointer (in libical).
This had been reported downstream as:
https://retrace.fedoraproject.org/faf/reports/1916092/
src/calendar/e-cal-backend-ews.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index e1bed08..7db264f 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -313,7 +313,6 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
icalcomponent *icalcomp, *vcomp;
icaltimezone *utc_zone = icaltimezone_get_utc_timezone ();
CamelEwsSettings *ews_settings;
- const gchar *mime_content;
g_return_val_if_fail (E_IS_CAL_BACKEND_EWS (cbews), NULL);
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -468,13 +467,14 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
icalcomponent_add_component (vcomp, icalcomp);
} else {
struct icaltimetype dt;
+ const gchar *mime_content;
const gchar *tzid;
gboolean timezone_set = FALSE;
mime_content = e_ews_item_get_mime_content (item);
- vcomp = icalparser_parse_string (mime_content);
+ vcomp = mime_content && *mime_content ? icalparser_parse_string (mime_content) : NULL;
- if (!vcomp && mime_content) {
+ if (!vcomp && mime_content && *mime_content) {
const gchar *begin_vcalendar, *end_vcalendar;
/* Workaround Exchange 2016 error, which returns invalid iCalendar object (without
'END:VCALENDAR'),
@@ -502,7 +502,8 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
}
if (!vcomp) {
- g_warn_if_reached ();
+ if (mime_content)
+ g_warn_if_reached ();
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]