From 0eb47b25bb54a289bb94917555b638a0ca19a3f9 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 14 May 2020 07:35:28 -0700 Subject: [PATCH] gb.openssl: Hash memory allocation [GB.OPENSSL] * BUG: Hash incorrectly allocated by sizeof a pointer. --- gb.openssl/src/c_openssl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gb.openssl/src/c_openssl.c b/gb.openssl/src/c_openssl.c index 4ebbaa999..d7fc80952 100644 --- a/gb.openssl/src/c_openssl.c +++ b/gb.openssl/src/c_openssl.c @@ -111,7 +111,7 @@ BEGIN_METHOD(OpenSSL_Pbkdf2, GB_STRING password; GB_STRING salt; GB_LONG iterati GB.Error("Invalid Parameter: method not a supported digest"); return; } - memset(hash, 0, sizeof(hash)); + memset(hash, 0, lKey)); ret = PKCS5_PBKDF2_HMAC((const char *) STRING(password), LENGTH(password), (const unsigned char *) STRING(salt), LENGTH(salt), (int) VARG(iterations), emethod, lKey, (unsigned char *) hash); if (ret == 0) { @@ -175,7 +175,7 @@ BEGIN_METHOD(OpenSSL_Scrypt, GB_STRING password; GB_STRING salt; GB_LONG N; GB_L GB.Error("Invalid Parameter: The combination of N, r, and p was rejected by OpenSSL"); return; } - memset(hash, 0, sizeof(hash)); + memset(hash, 0, lKey); ret = EVP_PBE_scrypt((const char *) STRING(password), LENGTH(password), (const unsigned char *) STRING(salt), LENGTH(salt), lN, lR, lP, 0, (unsigned char *) hash, lKey); if (ret == 0) {