diff libpurple/protocols/jabber/presence.c @ 31335:2d029c5cd305

jabber: Protect against broken OSes and printf("%s", NULL) crashes
author Paul Aurich <paul@darkrain42.org>
date Tue, 02 Nov 2010 02:06:13 +0000
parents 25e200cb3532
children 05c45d8f2ce3
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Tue Nov 02 01:57:06 2010 +0000
+++ b/libpurple/protocols/jabber/presence.c	Tue Nov 02 02:06:13 2010 +0000
@@ -995,12 +995,14 @@
 	}
 
 	for (child = packet->child; child; child = child->next) {
+		const char *xmlns;
 		char *key;
 		JabberPresenceHandler *pih;
 		if (child->type != XMLNODE_TYPE_TAG)
 			continue;
 
-		key = g_strdup_printf("%s %s", child->name, xmlnode_get_namespace(child));
+		xmlns = xmlnode_get_namespace(child);
+		key = g_strdup_printf("%s %s", child->name, xmlns ? xmlns : "");
 		pih = g_hash_table_lookup(presence_handlers, key);
 		g_free(key);
 		if (pih)