changeset 28156:191bb5bf2fc5

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 :)
author Marcus Lundblad <ml@update.uu.se>
date Mon, 31 Aug 2009 20:07:34 +0000
parents 86e6df9a0c80
children 087ad09cd4f5
files ChangeLog libpurple/protocols/jabber/data.c libpurple/protocols/jabber/message.c
diffstat 3 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 31 16:12:03 2009 +0000
+++ b/ChangeLog	Mon Aug 31 20:07:34 2009 +0000
@@ -18,6 +18,8 @@
 	  properly.  In addition, it is no longer possible to add buddies of
 	  the form "room@conference.example.net/User", where
 	  room@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
--- a/libpurple/protocols/jabber/data.c	Mon Aug 31 16:12:03 2009 +0000
+++ b/libpurple/protocols/jabber/data.c	Mon Aug 31 20:07:34 2009 +0000
@@ -77,6 +77,13 @@
 	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;
 
--- a/libpurple/protocols/jabber/message.c	Mon Aug 31 16:12:03 2009 +0000
+++ b/libpurple/protocols/jabber/message.c	Mon Aug 31 20:07:34 2009 +0000
@@ -493,7 +493,7 @@
 	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) {