diff libpurple/protocols/jabber/data.c @ 28515: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 7921a53b94b3
children 087ad09cd4f5
line wrap: on
line diff
--- 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;