comparison libpurple/protocols/msn/contact.c @ 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 e091c8ea292e
children 2c6510167895
comparison
equal deleted inserted replaced
32817:6fa0e854cfc6 32818:01ff09d4a463
724 annotation; 724 annotation;
725 annotation = xmlnode_get_next_twin(annotation)) { 725 annotation = xmlnode_get_next_twin(annotation)) {
726 char *name, *value; 726 char *name, *value;
727 name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); 727 name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
728 value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); 728 value = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
729 if (!strcmp(name, "MSN.IM.MPOP")) { 729 if (name && g_str_equal(name, "MSN.IM.MPOP")) {
730 if (!value || atoi(value) != 0) 730 if (!value || atoi(value) != 0)
731 session->enable_mpop = TRUE; 731 session->enable_mpop = TRUE;
732 else 732 else
733 session->enable_mpop = FALSE; 733 session->enable_mpop = FALSE;
734 } 734 }
800 Name = xmlnode_get_data(displayName); 800 Name = xmlnode_get_data(displayName);
801 else 801 else
802 Name = g_strdup(passport); 802 Name = g_strdup(passport);
803 803
804 for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation"); 804 for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation");
805 annotation; annotation = xmlnode_get_next_twin(annotation)) { 805 annotation;
806 annotation = xmlnode_get_next_twin(annotation)) {
806 char *name; 807 char *name;
807 name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); 808 name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
809 if (!name)
810 continue;
808 if (!strcmp(name, "AB.NickName")) 811 if (!strcmp(name, "AB.NickName"))
809 alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); 812 alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
810 else if (!strcmp(name, "MSN.IM.HasSharedFolder")) 813 else if (!strcmp(name, "MSN.IM.HasSharedFolder"))
811 ; /* Do nothing yet... */ 814 ; /* Do nothing yet... */
812 else if (!strcmp(name, "AB.Spouse")) 815 else if (!strcmp(name, "AB.Spouse"))