changeset 28382:d4847cef4a84

jabber: Fix a crash when the vcard includes an empty BINVAL. Patch from Matthew Chapman. Closes #10003.
author Paul Aurich <paul@darkrain42.org>
date Fri, 21 Aug 2009 07:15:47 +0000
parents 288ec4628f63
children adf7dc41770d
files COPYRIGHT libpurple/protocols/jabber/buddy.c
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Fri Aug 21 00:30:08 2009 +0000
+++ b/COPYRIGHT	Fri Aug 21 07:15:47 2009 +0000
@@ -88,6 +88,7 @@
 Matěj Cepl
 Cerulean Studios, LLC
 Jonathan Champ
+Matthew Chapman
 Christophe Chapuis
 Patrick Cheung
 Ka-Hing Cheung
--- a/libpurple/protocols/jabber/buddy.c	Fri Aug 21 00:30:08 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Fri Aug 21 07:15:47 2009 +0000
@@ -910,12 +910,14 @@
 	             (binval = xmlnode_get_child(photo, "BINVAL"))) {
 		gsize size;
 		char *bintext = xmlnode_get_data(binval);
-		guchar *data = purple_base64_decode(bintext, &size);
-		g_free(bintext);
+		if (bintext) {
+			guchar *data = purple_base64_decode(bintext, &size);
+			g_free(bintext);
 
-		if (data) {
-			vcard_hash = jabber_calculate_data_sha1sum(data, size);
-			g_free(data);
+			if (data) {
+				vcard_hash = jabber_calculate_data_sha1sum(data, size);
+				g_free(data);
+			}
 		}
 	}