changeset 31751:6da9e43e17d8

prefs: Avoid an atoi(NULL) when reading the prefs from disk Clang identified that no value attribute lead to an unconditional NULL deref here
author Paul Aurich <paul@darkrain42.org>
date Thu, 21 Jul 2011 03:16:51 +0000
parents cb4705abb991
children 3ef5e744589c
files libpurple/prefs.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/prefs.c	Wed Jul 20 16:51:55 2011 +0000
+++ b/libpurple/prefs.c	Thu Jul 21 03:16:51 2011 +0000
@@ -277,6 +277,12 @@
 		}
 	}
 
+	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;