--- a/libpurple/protocols/jabber/caps.c Thu Jun 01 19:09:16 2017 -0500
+++ b/libpurple/protocols/jabber/caps.c Fri Jun 02 15:09:01 2017 -0500
@@ -455,11 +455,7 @@
GChecksumType hash_type = G_CHECKSUM_SHA1;
- * TODO: If you add *any* hash here, make sure the checksum buffer
- * size in jabber_caps_calculate_hash is large enough. The cipher API
- * doesn't seem to offer a "Get the hash size" function(?).
if (g_str_equal(userdata->hash, "sha-1")) {
hash_type = G_CHECKSUM_SHA1;
} else if (g_str_equal(userdata->hash, "md5")) {
@@ -832,8 +828,9 @@
- gsize checksum_size = 20;
@@ -915,10 +912,16 @@
+ checksum_size = g_checksum_type_get_length(hash_type); + checksum = g_new(guint8, checksum_size); g_checksum_get_digest(hash, checksum, &checksum_size);
- return purple_base64_encode(checksum, checksum_size);
+ ret = purple_base64_encode(checksum, checksum_size); void jabber_caps_calculate_own_hash(JabberStream *js) {