Mercurial > pidgin
changeset 28293:c42d5c23a9e8
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.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 24 Sep 2009 16:58:31 +0000 |
parents | fa77b70c8ca6 |
children | 578b4048a501 |
files | ChangeLog libpurple/protocols/jabber/chat.c libpurple/protocols/jabber/roster.c |
diffstat | 3 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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')
--- 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);
--- 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.