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) {