Mercurial > pidgin
diff libpurple/protocols/jabber/presence.c @ 24693:61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
when bytes in the checksum start with 0 (for example, 430902... would become
4392...). Refs #7734, which has a second patch needing more detailed review.
committer: John Bailey <rekkanoryo@rekkanoryo.org>
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 11 Dec 2008 08:08:02 +0000 |
parents | 10ab5441572f |
children | bba38f03085d |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c Thu Dec 11 07:38:20 2008 +0000 +++ b/libpurple/protocols/jabber/presence.c Thu Dec 11 08:08:02 2008 +0000 @@ -21,7 +21,6 @@ #include "internal.h" #include "account.h" -#include "cipher.h" #include "conversation.h" #include "debug.h" #include "notify.h" @@ -349,19 +348,12 @@ (( (binval = xmlnode_get_child(photo, "BINVAL")) && (text = xmlnode_get_data(binval))) || (text = xmlnode_get_data(photo)))) { - unsigned char hashval[20]; - char hash[41], *p; - int i; + char *hash; data = purple_base64_decode(text, &size); - - purple_cipher_digest_region("sha1", data, size, - sizeof(hashval), hashval, NULL); - p = hash; - for(i=0; i<20; i++, p+=2) - snprintf(p, 3, "%02x", hashval[i]); - + hash = jabber_calculate_data_sha1sum(data, size); purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash); + g_free(hash); g_free(text); } }