libpurple/protocols/jabber/caps.c

changeset 38337
4b8cc47d05da
parent 38336
db6beb747e05
child 38339
9c9277601d98
--- a/libpurple/protocols/jabber/caps.c	Fri Jun 02 15:09:01 2017 -0500
+++ b/libpurple/protocols/jabber/caps.c	Fri Jun 02 15:14:32 2017 -0500
@@ -454,14 +454,20 @@
 	/* Only validate if these are v1.5 capabilities */
 	if (userdata->hash) {
 		gchar *hash = NULL;
-		GChecksumType hash_type = G_CHECKSUM_SHA1;
+		GChecksumType hash_type;
+		gboolean supported_hash = TRUE;
 
 		if (g_str_equal(userdata->hash, "sha-1")) {
 			hash_type = G_CHECKSUM_SHA1;
 		} else if (g_str_equal(userdata->hash, "md5")) {
 			hash_type = G_CHECKSUM_MD5;
+		} else {
+			supported_hash = FALSE;
 		}
-		hash = jabber_caps_calculate_hash(info, hash_type);
+
+		if (supported_hash) {
+			hash = jabber_caps_calculate_hash(info, hash_type);
+		}
 
 		if (!hash || !g_str_equal(hash, userdata->ver)) {
 			purple_debug_warning("jabber", "Could not validate caps info from "

mercurial