Fix bug 725224 - printf SEGV when passing NULL string on Solaris 10 in icalparser.c. r=philipp,a=philipp
authorGinn Chen <ginn.chen@oracle.com>
Wed, 08 Feb 2012 00:21:00 +0100
changeset 10169 e5f48721a62908856f2bb566ff441a06d6bae33f
parent 10168 9f3e1bfd37aa65ed30fba232175b3e9f5f1c5a06
child 10170 6fa3d8b42adeb4f861f7a3bcb6efb43a1433a6d8
push idunknown
push userunknown
push dateunknown
reviewersphilipp, philipp
bugs725224
Fix bug 725224 - printf SEGV when passing NULL string on Solaris 10 in icalparser.c. r=philipp,a=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;