cpw.darkrain42.xmpp.iq-handlers: 528b6f92: Avoid assertion failures on NULL 'from' ...

paul at darkrain42.org paul at darkrain42.org
Sun Feb 8 02:15:43 EST 2009


-----------------------------------------------------------------
Revision: 528b6f92c03b496c915051174c5b85fc46260287
Ancestor: c9b9cf5faea6a28039d60ea19874de22834f9069
Author: paul at darkrain42.org
Date: 2009-02-08T06:40:15
Branch: im.pidgin.cpw.darkrain42.xmpp.iq-handlers
URL: http://d.pidgin.im/viewmtn/revision/info/528b6f92c03b496c915051174c5b85fc46260287

Modified files:
        libpurple/protocols/jabber/iq.c
        libpurple/protocols/jabber/oob.c
        libpurple/protocols/jabber/ping.c

ChangeLog: 

Avoid assertion failures on NULL 'from' attributes

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/iq.c	6e32ebc6c1f5b7f7412eb46c35a435bfdb62250d
+++ libpurple/protocols/jabber/iq.c	c4c268fe58809fe57d96d37489d622869384c994
@@ -183,7 +183,8 @@ static void jabber_iq_last_parse(JabberS
 	if(type == JABBER_IQ_GET) {
 		iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:last");
 		jabber_iq_set_id(iq, id);
-		xmlnode_set_attrib(iq->node, "to", from);
+		if (from)
+			xmlnode_set_attrib(iq->node, "to", from);
 
 		query = xmlnode_get_child(iq->node, "query");
 
@@ -215,7 +216,8 @@ static void jabber_iq_time_parse(JabberS
 
 		iq = jabber_iq_new(js, JABBER_IQ_RESULT);
 		jabber_iq_set_id(iq, id);
-		xmlnode_set_attrib(iq->node, "to", from);
+		if (from)
+			xmlnode_set_attrib(iq->node, "to", from);
 
 		child = xmlnode_new_child(iq->node, child->name);
 		xmlnode_set_namespace(child, xmlns);
@@ -264,7 +266,8 @@ static void jabber_iq_version_parse(Jabb
 #endif
 
 		iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:version");
-		xmlnode_set_attrib(iq->node, "to", from);
+		if (from)
+			xmlnode_set_attrib(iq->node, "to", from);
 		jabber_iq_set_id(iq, id);
 
 		query = xmlnode_get_child(iq->node, "query");
@@ -351,8 +354,11 @@ void jabber_iq_parse(JabberStream *js, x
 
 			xmlnode_free(iq->node);
 			iq->node = xmlnode_copy(packet);
-			xmlnode_set_attrib(iq->node, "to", from);
-			xmlnode_remove_attrib(iq->node, "from");
+			if (from) {
+				xmlnode_set_attrib(iq->node, "to", from);
+				xmlnode_remove_attrib(iq->node, "from");
+			}
+
 			xmlnode_set_attrib(iq->node, "type", "error");
 			/* This id is clearly not useful, but we must put something there for a valid stanza */
 			iq->id = jabber_get_next_id(js);
@@ -399,8 +405,11 @@ void jabber_iq_parse(JabberStream *js, x
 
 		xmlnode_free(iq->node);
 		iq->node = xmlnode_copy(packet);
-		xmlnode_set_attrib(iq->node, "to", from);
-		xmlnode_remove_attrib(iq->node, "from");
+		if (from) {
+			xmlnode_set_attrib(iq->node, "to", from);
+			xmlnode_remove_attrib(iq->node, "from");
+		}
+
 		xmlnode_set_attrib(iq->node, "type", "error");
 		error = xmlnode_new_child(iq->node, "error");
 		xmlnode_set_attrib(error, "type", "cancel");
============================================================
--- libpurple/protocols/jabber/oob.c	49825e6b1badd0b43637ff3a0c1716849b04ae28
+++ libpurple/protocols/jabber/oob.c	d700c406a6100b21526b0991754fe41abd91a811
@@ -198,7 +198,7 @@ void jabber_oob_parse(JabberStream *js, 
 	if(type != JABBER_IQ_SET)
 		return;
 
-	if(!querynode)
+	if(!from)
 		return;
 
 	if(!(urlnode = xmlnode_get_child(querynode, "url")))
============================================================
--- libpurple/protocols/jabber/ping.c	80fd859d8a83cfd9ecb46c7391387ef57585cbec
+++ libpurple/protocols/jabber/ping.c	4083811c6d5c709175584918789f4a7f359e7876
@@ -43,7 +43,8 @@ jabber_ping_parse(JabberStream *js, cons
 	if (type == JABBER_IQ_GET) {
 		JabberIq *iq = jabber_iq_new(js, JABBER_IQ_RESULT);
 
-		xmlnode_set_attrib(iq->node, "to", from);
+		if (from)
+			xmlnode_set_attrib(iq->node, "to", from);
 		xmlnode_set_attrib(iq->node, "id", id);
 
 		jabber_iq_send(iq);


More information about the Commits mailing list