comparison libpurple/protocols/jabber/buddy.c @ 28032: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 cc70e2bc4de5
children c585572e80dd
comparison
equal deleted inserted replaced
28031:288ec4628f63 28032:d4847cef4a84
908 908
909 if (vcard && (photo = xmlnode_get_child(vcard, "PHOTO")) && 909 if (vcard && (photo = xmlnode_get_child(vcard, "PHOTO")) &&
910 (binval = xmlnode_get_child(photo, "BINVAL"))) { 910 (binval = xmlnode_get_child(photo, "BINVAL"))) {
911 gsize size; 911 gsize size;
912 char *bintext = xmlnode_get_data(binval); 912 char *bintext = xmlnode_get_data(binval);
913 guchar *data = purple_base64_decode(bintext, &size); 913 if (bintext) {
914 g_free(bintext); 914 guchar *data = purple_base64_decode(bintext, &size);
915 915 g_free(bintext);
916 if (data) { 916
917 vcard_hash = jabber_calculate_data_sha1sum(data, size); 917 if (data) {
918 g_free(data); 918 vcard_hash = jabber_calculate_data_sha1sum(data, size);
919 g_free(data);
920 }
919 } 921 }
920 } 922 }
921 923
922 /* Republish our vcard if the photo is different than the server's */ 924 /* Republish our vcard if the photo is different than the server's */
923 if (!purple_strequal(vcard_hash, js->initial_avatar_hash)) { 925 if (!purple_strequal(vcard_hash, js->initial_avatar_hash)) {