pidgin: fc923d51: jabber: Don't crash when adding a buddy ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Thu Sep 24 23:47:17 EDT 2009


-----------------------------------------------------------------
Revision: fc923d51762533d8ba5e7898fe6130fb99e74937
Ancestor: 932eeb7a0332703a53529cc3583d8088db89170c
Author: darkrain42 at pidgin.im
Date: 2009-09-24T16:58:31
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/fc923d51762533d8ba5e7898fe6130fb99e74937

Modified files:
        ChangeLog libpurple/protocols/jabber/chat.c
        libpurple/protocols/jabber/roster.c

ChangeLog: 

jabber: Don't crash when adding a buddy without a node (no '@'). Closes #10261.

Also add some assertions to jabber_chat_find so this doesn't cause a
crash in the future.

-------------- next part --------------
============================================================
--- ChangeLog	12253c4c9f663dde096dc532f36badd997af95cd
+++ ChangeLog	ca34559e960a037f1f199275ec1b59f3814cc785
@@ -5,6 +5,7 @@ version 2.6.3 (??/??/20??):
 	* Fix a crash when attempting to validate an invalid JID.
 	* Resolve an issue when connecting to iChat Server when no resource
 	  is specified.
+	* Fix a crash when adding a buddy without an '@'.
 
 	General:
 	* New 'plugins' sub-command to 'debug' command (i.e. '/debug plugins')
============================================================
--- libpurple/protocols/jabber/chat.c	5d5a20b0deab84c51ee9ee1cdf41d1c544375169
+++ libpurple/protocols/jabber/chat.c	a30c442543d86813e3577a005e911d89a484c7cf
@@ -99,6 +99,9 @@ JabberChat *jabber_chat_find(JabberStrea
 {
 	JabberChat *chat = NULL;
 
+	g_return_val_if_fail(room != NULL, NULL);
+	g_return_val_if_fail(server != NULL, NULL);
+
 	if(NULL != js->chats)
 	{
 		char *room_jid = g_strdup_printf("%s@%s", room, server);
============================================================
--- libpurple/protocols/jabber/roster.c	4b11bd34ec3b831e400b1775eefadc667e7390f0
+++ libpurple/protocols/jabber/roster.c	e5cb0fd6d8bf4076e096ea1d80a13ed4ec4b6b5c
@@ -354,7 +354,7 @@ void jabber_roster_add_buddy(PurpleConne
 	}
 
 	/* Adding a chat room or a chat buddy to the roster is *not* supported. */
-	if (jabber_chat_find(js, jid->node, jid->domain) != NULL) {
+	if (jid->node && jabber_chat_find(js, jid->node, jid->domain) != NULL) {
 		/*
 		 * This is the same thing Bonjour does. If it causes problems, move
 		 * it to an idle callback.


More information about the Commits mailing list