Fix potential crash in vcalendar's icalcomponent_vanew() on 64-bit archs.
authorAndrej Kacian <ticho@claws-mail.org>
Mon, 15 Aug 2016 11:32:41 +0000 (13:32 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Mon, 15 Aug 2016 11:32:41 +0000 (13:32 +0200)
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
src/plugins/vcalendar/vcal_manager.c
src/plugins/vcalendar/vcal_meeting_gtk.c

index 6eb2320..76a0352 100644 (file)
@@ -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);
index e367c42..771c731 100644 (file)
@@ -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) {
index a33900a..da07bea 100644 (file)
@@ -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",