Don't crash when receiving an error iq response when trying fetch a custom
authorMarcus Lundblad <malu@pidgin.im>
Mon, 31 Aug 2009 20:07:34 +0000
changeset2da956f23839 pushlog
parent a0a2fbbb9dbc
child 8eccffa3d7be
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 :)
ChangeLog
libpurple/protocols/jabber/data.c
libpurple/protocols/jabber/message.c
      1.1 --- a/ChangeLog
      1.2 +++ b/ChangeLog
      1.3 @@ -18,6 +18,8 @@
      1.4  	  properly.  In addition, it is no longer possible to add buddies of
      1.5  	  the form "room@conference.example.net/User", where
      1.6  	  room@conference.example.net is a MUC.
      1.7 +	* Don't crash when receiving "smileyfied" XHTML-IM from clients that don't
      1.8 +	  support bits of binary (ie. when getting an empty <data/> in return)
      1.9  
     1.10  	Yahoo!/Yahoo! JAPAN:
     1.11  	* Accounts now have "Use account proxy for SSL connections" option.  This
      2.1 --- a/libpurple/protocols/jabber/data.c
      2.2 +++ b/libpurple/protocols/jabber/data.c
      2.3 @@ -77,6 +77,13 @@
      2.4  	data->type = g_strdup(xmlnode_get_attrib(tag, "type"));
      2.5  
      2.6  	raw_data = xmlnode_get_data(tag);
      2.7 +
      2.8 +	if (raw_data == NULL) {
      2.9 +		purple_debug_error("jabber", "data element was empty");
     2.10 +		g_free(data);
     2.11 +		return NULL;
     2.12 +	}
     2.13 +
     2.14  	data->data = purple_base64_decode(raw_data, &size);
     2.15  	data->size = size;
     2.16  
      3.1 --- a/libpurple/protocols/jabber/message.c
      3.2 +++ b/libpurple/protocols/jabber/message.c
      3.3 @@ -493,7 +493,7 @@
      3.4  	xmlnode *item_not_found = xmlnode_get_child(packet, "item-not-found");
      3.5  
      3.6  	/* did we get a data element as result? */
      3.7 -	if (data_element) {
      3.8 +	if (data_element && type == JABBER_IQ_RESULT) {
      3.9  		JabberData *data = jabber_data_create_from_xml(data_element);
     3.10  
     3.11  		if (data) {