changeset 32818:01ff09d4a463

applied changes from 444dec0882a9950944852a408a50904a458629bf through 1f233991b11d30d7bd9d1e058e19fe162a9600f3 Apparently, some random servers have decided to send us an annotation with no name, and the value isn't really self-describing either. Anyway, this empty name could cause a crash. Fixes #15126.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 Jun 2012 02:30:13 +0000
parents 6fa0e854cfc6
children 2c6510167895
files libpurple/protocols/msn/contact.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Sat Jun 02 02:27:41 2012 +0000
+++ b/libpurple/protocols/msn/contact.c	Sat Jun 02 02:30:13 2012 +0000
@@ -726,7 +726,7 @@
 				char *name, *value;
 				name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
 				value = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
-				if (!strcmp(name, "MSN.IM.MPOP")) {
+				if (name && g_str_equal(name, "MSN.IM.MPOP")) {
 					if (!value || atoi(value) != 0)
 						session->enable_mpop = TRUE;
 					else
@@ -802,9 +802,12 @@
 			Name = g_strdup(passport);
 
 		for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation");
-				annotation; annotation = xmlnode_get_next_twin(annotation)) {
+		     annotation;
+		     annotation = xmlnode_get_next_twin(annotation)) {
 			char *name;
 			name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
+			if (!name)
+				continue;
 			if (!strcmp(name, "AB.NickName"))
 				alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
 			else if (!strcmp(name, "MSN.IM.HasSharedFolder"))