From bb75c498eba5e6914638369ba5829ad35929eb1a Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Sat, 1 Aug 2020 20:40:24 +0300
Subject: Jabber: fix for the context size calculation

---
 protocols/JabberG/src/jabber_secur.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'protocols/JabberG')

diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp
index fa55ce43a5..fc397cdbc7 100644
--- a/protocols/JabberG/src/jabber_secur.cpp
+++ b/protocols/JabberG/src/jabber_secur.cpp
@@ -297,11 +297,11 @@ char* TScramAuth::getChallenge(const char *challenge)
 	unsigned int len;
 	HMAC(hashMethod, saltedPassw, hashMethod->md_size, (BYTE*)"Client Key", 10, clientKey, &len);
 
-	BYTE storedKey[EVP_MAX_MD_SIZE], md[EVP_MAX_MD_SIZE];
+	BYTE storedKey[EVP_MAX_MD_SIZE];
 
 	EVP_MD_CTX pctx = {};
 	pctx.digest = hashMethod;
-	pctx.md_data = md;
+	pctx.md_data = _alloca(hashMethod->ctx_size);
 	hashMethod->init(&pctx);
 	hashMethod->update(&pctx, clientKey, hashMethod->md_size);
 	hashMethod->final(&pctx, storedKey);
-- 
cgit v1.2.3