pidgin: 0d3e7183: Don't crash when resource is NULL. Thank...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Thu May 7 13:50:38 EDT 2009


-----------------------------------------------------------------
Revision: 0d3e7183f1b6345a8fda3322c688e7e922536162
Ancestor: 4d3b47389a469bb6ad059b99dbd53bd5f30f1d0e
Author: darkrain42 at pidgin.im
Date: 2009-05-07T17:04:59
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0d3e7183f1b6345a8fda3322c688e7e922536162

Modified files:
        libpurple/protocols/jabber/presence.c

ChangeLog: 

Don't crash when resource is NULL. Thanks, Marcus!

#0  0x00007ffe6d203a92 in strcmp () from /lib/libc.so.6
#1  0x00007ffe5c588406 in jabber_buddy_find_resource (
    jb=<value optimized out>, resource=0x1 <Address 0x1 out of bounds>)
    at buddy.c:143
#2  0x00007ffe5c5a7303 in jabber_presence_set_capabilities (info=0x0, 
    exts=0x0, userdata=0x11da700) at presence.c:410

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c	8527f75e4713317f89e960cdc10d1edecc73f87d
+++ libpurple/protocols/jabber/presence.c	7d5b4902fe81e652e787c723df40363000ed24e2
@@ -404,9 +404,11 @@ jabber_presence_set_capabilities(JabberC
                                  JabberPresenceCapabilities *userdata)
 {
 	JabberBuddyResource *jbr;
-	char *resource = g_utf8_strrchr(userdata->from, -1, '/');
-	resource += 1;
+	char *resource = g_utf8_strchr(userdata->from, -1, '/');
 
+	if (resource)
+		resource += 1;
+
 	jbr = jabber_buddy_find_resource(userdata->jb, resource);
 	if (!jbr) {
 		g_free(userdata->from);


More information about the Commits mailing list