pidgin: 36a2252d: jabber: Fix a crash when sending typing ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Thu Jun 17 15:25:51 EDT 2010


-----------------------------------------------------------------
Revision: 36a2252d33b7a01e01f00ac7599f91059951e47e
Ancestor: ca8febcd75d5d72dae81ba4d2c0b30c1620853c9
Author: darkrain42 at pidgin.im
Date: 2010-06-17T19:17:32
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/36a2252d33b7a01e01f00ac7599f91059951e47e

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

ChangeLog: 

jabber: Fix a crash when sending typing notifications to a malformed buddy

E.g. "test at example.com ".  Reported by Mark.


-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/message.c	01bd63d3f9d470888095e5c4bfe40307f3ef761e
+++ libpurple/protocols/jabber/message.c	45645a38d429674a2a45c79226aa8ec6b8ea4562
@@ -1239,14 +1239,19 @@ unsigned int jabber_send_typing(PurpleCo
 
 unsigned int jabber_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
 {
+	JabberStream *js;
 	JabberMessage *jm;
 	JabberBuddy *jb;
 	JabberBuddyResource *jbr;
-	char *resource = jabber_get_resource(who);
+	char *resource;	
 
-	jb = jabber_buddy_find(gc->proto_data, who, TRUE);
+	js = purple_connection_get_protocol_data(gc);
+	jb = jabber_buddy_find(js, who, TRUE);
+	if (!jb)
+		return 0;
+
+	resource = jabber_get_resource(who);
 	jbr = jabber_buddy_find_resource(jb, resource);
-
 	g_free(resource);
 
 	/* We know this entity doesn't support chat states */
@@ -1261,7 +1266,7 @@ unsigned int jabber_send_typing(PurpleCo
 
 	/* TODO: figure out threading */
 	jm = g_new0(JabberMessage, 1);
-	jm->js = gc->proto_data;
+	jm->js = js;
 	jm->type = JABBER_MESSAGE_CHAT;
 	jm->to = g_strdup(who);
 	jm->id = jabber_get_next_id(jm->js);


More information about the Commits mailing list