pidgin: fd595561: Don't crash when receiving an error iq r...

malu at pidgin.im malu at pidgin.im
Mon Aug 31 16:11:49 EDT 2009


-----------------------------------------------------------------
Revision: fd5955618eddcd84d522b30ff11102f9601f38c8
Ancestor: eb7f43240a9076b19941ad012cb5b9046f5cd0ce
Author: malu at pidgin.im
Date: 2009-08-31T20:07:34
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/fd5955618eddcd84d522b30ff11102f9601f38c8

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

ChangeLog: 

Don't crash when receiving an error iq response when trying fetch a custom
smiley (will happen if a client not supporting BoB sends XHTML-IM containing
cid: images).
Thanks to Florob, Waqas and Darkrain for finding and hinting about this :)


-------------- next part --------------
============================================================
--- ChangeLog	a4cff6ef6de87fd8a82b3c12dc0b08e9f8b4c0f4
+++ ChangeLog	2a5c81f3e17a1ad23ab8a81ec7d33aa4a8f7e396
@@ -18,6 +18,8 @@ version 2.6.2 (??/??/2009):
 	  properly.  In addition, it is no longer possible to add buddies of
 	  the form "room at conference.example.net/User", where
 	  room at conference.example.net is a MUC.
+	* Don't crash when receiving "smileyfied" XHTML-IM from clients that don't
+	  support bits of binary (ie. when getting an empty <data/> in return)
 
 	Yahoo!/Yahoo! JAPAN:
 	* Accounts now have "Use account proxy for SSL connections" option.  This
============================================================
--- libpurple/protocols/jabber/data.c	d86021529f80b4f728480cf8462bec5d4501c416
+++ libpurple/protocols/jabber/data.c	b90153a7dcbd66579e18c499775d97ae2f226a57
@@ -77,6 +77,13 @@ jabber_data_create_from_xml(xmlnode *tag
 	data->type = g_strdup(xmlnode_get_attrib(tag, "type"));
 
 	raw_data = xmlnode_get_data(tag);
+
+	if (raw_data == NULL) {
+		purple_debug_error("jabber", "data element was empty");
+		g_free(data);
+		return NULL;
+	}
+
 	data->data = purple_base64_decode(raw_data, &size);
 	data->size = size;
 
============================================================
--- libpurple/protocols/jabber/message.c	21cd394353687a7b01d5a2eb49e7df666c146b63
+++ libpurple/protocols/jabber/message.c	1b5ea4b67a7c657a01af1322b860c33f2cadf0df
@@ -493,7 +493,7 @@ jabber_message_get_data_cb(JabberStream 
 	xmlnode *item_not_found = xmlnode_get_child(packet, "item-not-found");
 
 	/* did we get a data element as result? */
-	if (data_element) {
+	if (data_element && type == JABBER_IQ_RESULT) {
 		JabberData *data = jabber_data_create_from_xml(data_element);
 
 		if (data) {


More information about the Commits mailing list