changeset 26842:33f98d662db8

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
author Paul Aurich <paul@darkrain42.org>
date Thu, 07 May 2009 17:04:59 +0000
parents b0f61cb90f62
children 9ce0c5bc922c 70fdb6fc8aee
files libpurple/protocols/jabber/presence.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Thu May 07 05:23:15 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c	Thu May 07 17:04:59 2009 +0000
@@ -404,8 +404,10 @@
                                  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) {