[svn-commits] file: trunk r370126 - /trunk/res/res_xmpp.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 16 14:14:33 CDT 2012


Author: file
Date: Mon Jul 16 14:14:29 2012
New Revision: 370126

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370126
Log:
Fix an issue where a service discovery request could crash Asterisk.

A server sending a service discovery request to us may or may not put a from attribute in the message. If the from attribute is present use it in the to attribute for the result. If the from attribute is not present do not add a to attribute.

(issue ASTERISK-16203)
Reported by: wubbla

Modified:
    trunk/res/res_xmpp.c

Modified: trunk/res/res_xmpp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_xmpp.c?view=diff&rev=370126&r1=370125&r2=370126
==============================================================================
--- trunk/res/res_xmpp.c (original)
+++ trunk/res/res_xmpp.c Mon Jul 16 14:14:29 2012
@@ -2211,7 +2211,11 @@
 	}
 
 	iks_insert_attrib(iq, "from", client->jid->full);
-	iks_insert_attrib(iq, "to", pak->from->full);
+
+	if (pak->from) {
+		iks_insert_attrib(iq, "to", pak->from->full);
+	}
+
 	iks_insert_attrib(iq, "type", "result");
 	iks_insert_attrib(iq, "id", pak->id);
 	iks_insert_attrib(query, "xmlns", "http://jabber.org/protocol/disco#info");
@@ -3037,8 +3041,11 @@
 	}
 
 	if (!(buddy = ao2_find(client->buddies, pak->from->partial, OBJ_KEY))) {
-		ast_log(LOG_WARNING, "Received presence information about '%s' despite not having them in roster on client '%s'\n",
-			pak->from->partial, client->name);
+		/* Only output the message if it is not about us */
+		if (strcmp(client->jid->partial, pak->from->partial)) {
+			ast_log(LOG_WARNING, "Received presence information about '%s' despite not having them in roster on client '%s'\n",
+				pak->from->partial, client->name);
+		}
 		return 0;
 	}
 




More information about the svn-commits mailing list