pidgin: 86b81140: prefs: Avoid an atoi(NULL) when reading ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Thu Jul 21 01:45:52 EDT 2011


----------------------------------------------------------------------
Revision: 86b81140cf9a026a5120ddaee8e918c06d347d90
Parent:   abf0c7744ea5b27942257ab98f6c0dba7480778a
Author:   darkrain42 at pidgin.im
Date:     07/20/11 23:16:51
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/86b81140cf9a026a5120ddaee8e918c06d347d90

Changelog: 

prefs: Avoid an atoi(NULL) when reading the prefs from disk

Clang identified that no value attribute lead to an unconditional NULL deref here

Changes against parent abf0c7744ea5b27942257ab98f6c0dba7480778a

  patched  libpurple/prefs.c

-------------- next part --------------
============================================================
--- libpurple/prefs.c	7cc6a7e6bf59bf4cea5e0dbc1c6b329f64ff0712
+++ libpurple/prefs.c	29d1bfb642ae090250dbcee59fd2e1890cb195c3
@@ -277,6 +277,12 @@ prefs_start_element_handler (GMarkupPars
 		}
 	}
 
+	if ((pref_type == PURPLE_PREF_BOOLEAN || pref_type == PURPLE_PREF_INT) &&
+			pref_value == NULL) {
+		/* Missing a value attribute */
+		return;
+	}
+
 	if(purple_strequal(element_name, "item")) {
 		struct purple_pref *pref;
 


More information about the Commits mailing list