[evolution-data-server/gnome-3-10] libedata-cal: Fix a potential g_strstrip(NULL) call



commit 6fdf53e84fb90f8e3a929d123d1eb733757ddbbb
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Nov 29 08:56:57 2013 +0000

    libedata-cal: Fix a potential g_strstrip(NULL) call
    
    If the calendar contained any attendees _not_ prefixed with ‘mailto:’,
    the text variable would be NULL, and would cause an assertion failure in
    g_strstrip().
    
    Found by scan-build.
    
    https://bugzilla.gnome.org/719533
    
    (cherry picked from commit 3304de4e2db1be25fb40a413e824b6c0f44069a9)

 calendar/libedata-cal/e-cal-backend-util.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/calendar/libedata-cal/e-cal-backend-util.c b/calendar/libedata-cal/e-cal-backend-util.c
index 2c7cd23..ebdd1ed 100644
--- a/calendar/libedata-cal/e-cal-backend-util.c
+++ b/calendar/libedata-cal/e-cal-backend-util.c
@@ -167,7 +167,7 @@ is_attendee_declined (icalcomponent *icalcomp,
             prop != NULL;
             prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
                gchar *attendee;
-               gchar *text = NULL;
+               gchar *text;
 
                attendee = icalproperty_get_value_as_string_r (prop);
                if (!attendee)
@@ -175,6 +175,9 @@ is_attendee_declined (icalcomponent *icalcomp,
 
                if (!g_ascii_strncasecmp (attendee, "mailto:";, 7))
                        text = g_strdup (attendee + 7);
+               else
+                       text = g_strdup (attendee);
+
                text = g_strstrip (text);
 
                if (!g_ascii_strcasecmp (email, text)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]