From d20742effa4de1e3a21a4d2b2a0512e7d166f08d Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Mon, 15 Aug 2016 13:32:41 +0200 Subject: [PATCH] Fix potential crash in vcalendar's icalcomponent_vanew() on 64-bit archs. We need to pass the terminating zero cast to void*, because size of void* is 8 bytes, while size of a literal 0 just 4 bytes. The arguments are retrieved as void*, so without this void* cast, we're taking four extra bytes belonging to whatever data is stored in memory directly after our four-byte zero. --- src/plugins/vcalendar/vcal_folder.c | 2 +- src/plugins/vcalendar/vcal_manager.c | 6 +++--- src/plugins/vcalendar/vcal_meeting_gtk.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c index 6eb23209d..76a035240 100644 --- a/src/plugins/vcalendar/vcal_folder.c +++ b/src/plugins/vcalendar/vcal_folder.c @@ -2111,7 +2111,7 @@ gchar *vcal_get_event_as_ical_str(VCalEvent *event) icalproperty_new_prodid( "-//Claws Mail//NONSGML Claws Mail Calendar//EN"), icalproperty_new_calscale("GREGORIAN"), - 0); + (void*)0); vcal_manager_event_dump(event, FALSE, FALSE, calendar, FALSE); ical = g_strdup(icalcomponent_as_ical_string(calendar)); icalcomponent_free(calendar); diff --git a/src/plugins/vcalendar/vcal_manager.c b/src/plugins/vcalendar/vcal_manager.c index e367c42fe..771c73182 100644 --- a/src/plugins/vcalendar/vcal_manager.c +++ b/src/plugins/vcalendar/vcal_manager.c @@ -347,7 +347,7 @@ gchar *vcal_manager_event_dump(VCalEvent *event, gboolean is_reply, gboolean is_ "-//Claws Mail//NONSGML Claws Mail Calendar//EN"), icalproperty_new_calscale("GREGORIAN"), icalproperty_new_method(is_reply ? ICAL_METHOD_REPLY:event->method), - 0 + (void*)0 ); if (!calendar) { @@ -380,7 +380,7 @@ gchar *vcal_manager_event_dump(VCalEvent *event, gboolean is_reply, gboolean is_ ievent = icalcomponent_vanew( - ICAL_VEVENT_COMPONENT, 0); + ICAL_VEVENT_COMPONENT, (void*)0); if (!ievent) { g_warning ("can't generate event"); @@ -700,7 +700,7 @@ gchar *vcal_manager_icalevent_dump(icalcomponent *event, gchar *orga, icalcompon "-//Claws Mail//NONSGML Claws Mail Calendar//EN"), icalproperty_new_calscale("GREGORIAN"), icalproperty_new_method(ICAL_METHOD_PUBLISH), - 0 + (void*)0 ); if (!calendar) { diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c index a33900ab5..da07beadd 100644 --- a/src/plugins/vcalendar/vcal_meeting_gtk.c +++ b/src/plugins/vcalendar/vcal_meeting_gtk.c @@ -1974,7 +1974,7 @@ void multisync_export(void) icalproperty_new_prodid( "-//Claws Mail//NONSGML Claws Mail Calendar//EN"), icalproperty_new_calscale("GREGORIAN"), - 0 + (void*)0 ); vcal_manager_event_dump(event, FALSE, FALSE, calendar, FALSE); tmp = g_strconcat(path, G_DIR_SEPARATOR_S, file, NULL); @@ -2050,7 +2050,7 @@ gboolean vcal_meeting_export_calendar(const gchar *path, icalproperty_new_prodid( "-//Claws Mail//NONSGML Claws Mail Calendar//EN"), icalproperty_new_calscale("GREGORIAN"), - 0 + (void*)0 ); for (cur = list; cur; cur = cur->next) { @@ -2162,7 +2162,7 @@ gboolean vcal_meeting_export_freebusy(const gchar *path, const gchar *user, icalproperty_new_prodid( "-//Claws Mail//NONSGML Claws Mail Calendar//EN"), icalproperty_new_calscale("GREGORIAN"), - 0 + (void*)0 ); timezone = icalcomponent_new(ICAL_VTIMEZONE_COMPONENT); @@ -2196,7 +2196,7 @@ gboolean vcal_meeting_export_freebusy(const gchar *path, const gchar *user, ICAL_VFREEBUSY_COMPONENT, icalproperty_vanew_dtstart(itt_start, 0), icalproperty_vanew_dtend(itt_end, 0), - 0 + (void*)0 ); debug_print("DTSTART:%s\nDTEND:%s\n",