# HG changeset patch # User Paul Aurich # Date 1253811511 0 # Node ID c42d5c23a9e893a4e834cab235e6202d4cf0855a # Parent fa77b70c8ca621ef7855d288fb789556d07aaf8d 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. diff -r fa77b70c8ca6 -r c42d5c23a9e8 ChangeLog --- a/ChangeLog Thu Sep 24 16:38:49 2009 +0000 +++ b/ChangeLog Thu Sep 24 16:58:31 2009 +0000 @@ -5,6 +5,7 @@ * 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') diff -r fa77b70c8ca6 -r c42d5c23a9e8 libpurple/protocols/jabber/chat.c --- a/libpurple/protocols/jabber/chat.c Thu Sep 24 16:38:49 2009 +0000 +++ b/libpurple/protocols/jabber/chat.c Thu Sep 24 16:58:31 2009 +0000 @@ -99,6 +99,9 @@ { 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); diff -r fa77b70c8ca6 -r c42d5c23a9e8 libpurple/protocols/jabber/roster.c --- a/libpurple/protocols/jabber/roster.c Thu Sep 24 16:38:49 2009 +0000 +++ b/libpurple/protocols/jabber/roster.c Thu Sep 24 16:58:31 2009 +0000 @@ -354,7 +354,7 @@ } /* 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.