comparison 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
comparison
equal deleted inserted replaced
31334:5750f2f2cc0d 31335:2d029c5cd305
993 "'%s'\n", type); 993 "'%s'\n", type);
994 goto out; 994 goto out;
995 } 995 }
996 996
997 for (child = packet->child; child; child = child->next) { 997 for (child = packet->child; child; child = child->next) {
998 const char *xmlns;
998 char *key; 999 char *key;
999 JabberPresenceHandler *pih; 1000 JabberPresenceHandler *pih;
1000 if (child->type != XMLNODE_TYPE_TAG) 1001 if (child->type != XMLNODE_TYPE_TAG)
1001 continue; 1002 continue;
1002 1003
1003 key = g_strdup_printf("%s %s", child->name, xmlnode_get_namespace(child)); 1004 xmlns = xmlnode_get_namespace(child);
1005 key = g_strdup_printf("%s %s", child->name, xmlns ? xmlns : "");
1004 pih = g_hash_table_lookup(presence_handlers, key); 1006 pih = g_hash_table_lookup(presence_handlers, key);
1005 g_free(key); 1007 g_free(key);
1006 if (pih) 1008 if (pih)
1007 pih(js, &presence, child); 1009 pih(js, &presence, child);
1008 } 1010 }