Fix bug 725224 - printf SEGV when passing NULL string on Solaris 10 in icalparser.c. r=philipp
authorGinn Chen <ginn.chen@oracle.com>
Wed, 08 Feb 2012 00:21:00 +0100
changeset 9354 e8afafcf0a12de09725607b4e8ab2d30ca87f58f
parent 9353 0dd576f063aa5356a24ac3e04121b0f7695efea6
child 9355 3ed870bf0b17fb1e9a21ad04324bd59418cd541d
push id7167
push usermozilla@kewis.ch
push dateSun, 12 Feb 2012 11:05:43 +0000
treeherdercomm-central@e8afafcf0a12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs725224
Fix bug 725224 - printf SEGV when passing NULL string on Solaris 10 in icalparser.c. r=philipp
calendar/libical/src/libical/icalparser.c
--- a/calendar/libical/src/libical/icalparser.c
+++ b/calendar/libical/src/libical/icalparser.c
@@ -1102,19 +1102,20 @@ icalcomponent* icalparser_add_line(icalp
 	    str = NULL;
 
 	} else {
 	    if (vcount == 0){
 		char temp[200]; /* HACK */
 		
 		icalproperty_kind prop_kind = icalproperty_isa(prop);
 		icalcomponent *tail = pvl_data(pvl_tail(parser->components));
+		const char* property_name = icalproperty_kind_to_string(prop_kind);
 		
 		snprintf(temp,sizeof(temp),"No value for %s property. Removing entire property",
-			icalproperty_kind_to_string(prop_kind));
+			property_name ? property_name : "(null)");
 
 		insert_error(tail, str, temp,
 			     ICAL_XLICERRORTYPE_VALUEPARSEERROR);
 
 		/* Remove the troublesome property */
 		icalcomponent_remove_property(tail,prop);
 		icalproperty_free(prop);
 		prop = 0;