diff options
author | Marcus Lundblad <malu@pidgin.im> | 2009-08-31 20:07:34 +0000 |
---|---|---|
committer | Marcus Lundblad <malu@pidgin.im> | 2009-08-31 20:07:34 +0000 |
commit | 53693847176510ce037c1da781e61e5e8ce18274 (patch) | |
tree | 7f3df62be3097f0f727fde85224d467a983e34ca /libpurple | |
parent | 703291a058916b170cd4fe29379b10f950fb825a (diff) | |
download | pidgin-53693847176510ce037c1da781e61e5e8ce18274.tar.gz |
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 :)
Diffstat (limited to 'libpurple')
-rw-r--r-- | libpurple/protocols/jabber/data.c | 7 | ||||
-rw-r--r-- | libpurple/protocols/jabber/message.c | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/libpurple/protocols/jabber/data.c b/libpurple/protocols/jabber/data.c index fe2fd7ed98..61d5eca3d2 100644 --- a/libpurple/protocols/jabber/data.c +++ b/libpurple/protocols/jabber/data.c @@ -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; diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c index 6b11259a65..9fac494f40 100644 --- a/libpurple/protocols/jabber/message.c +++ b/libpurple/protocols/jabber/message.c @@ -493,7 +493,7 @@ jabber_message_get_data_cb(JabberStream *js, const char *from, 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) { |