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 6eb23209d13acefcbb886b2272b35d5d0685a2d2..76a035240630893d6fc7e7f7cc413e98feada27e 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"),
             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);
        vcal_manager_event_dump(event, FALSE, FALSE, calendar, FALSE);
        ical = g_strdup(icalcomponent_as_ical_string(calendar));
        icalcomponent_free(calendar);
index e367c42fea1dd330258fbf2c8a9cc17ae7dd0433..771c7318219c94a55a701edb7272d9eaa9321485 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),
                                 "-//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) {
                            );  
 
        if (!calendar) {
@@ -380,7 +380,7 @@ gchar *vcal_manager_event_dump(VCalEvent *event, gboolean is_reply, gboolean is_
 
        ievent = 
            icalcomponent_vanew(
 
        ievent = 
            icalcomponent_vanew(
-                ICAL_VEVENT_COMPONENT, 0);
+                ICAL_VEVENT_COMPONENT, (void*)0);
 
        if (!ievent) {
                g_warning ("can't generate event");
 
        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),
                                 "-//Claws Mail//NONSGML Claws Mail Calendar//EN"),
                            icalproperty_new_calscale("GREGORIAN"),
                            icalproperty_new_method(ICAL_METHOD_PUBLISH),
-                           0
+                           (void*)0
                            );  
 
        if (!calendar) {
                            );  
 
        if (!calendar) {
index a33900ab540daf2539d82d0d9bbe3e805f1c4a16..da07beadd6a73c1f6b4240dbe7945c3be88d8fc6 100644 (file)
@@ -1974,7 +1974,7 @@ void multisync_export(void)
                            icalproperty_new_prodid(
                                 "-//Claws Mail//NONSGML Claws Mail Calendar//EN"),
                            icalproperty_new_calscale("GREGORIAN"),
                            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);
                    );  
                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"),
                    icalproperty_new_prodid(
                         "-//Claws Mail//NONSGML Claws Mail Calendar//EN"),
                    icalproperty_new_calscale("GREGORIAN"),
-                   0
+                   (void*)0
             );         
 
        for (cur = list; cur; cur = cur->next) {
             );         
 
        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"),
                    icalproperty_new_prodid(
                         "-//Claws Mail//NONSGML Claws Mail Calendar//EN"),
                    icalproperty_new_calscale("GREGORIAN"),
-                   0
+                   (void*)0
             );         
 
        timezone = icalcomponent_new(ICAL_VTIMEZONE_COMPONENT);
             );         
 
        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),
                 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",
                 );
 
        debug_print("DTSTART:%s\nDTEND:%s\n",