mirror of
https://github.com/openssl/openssl.git
synced 2025-02-17 14:32:04 +08:00
Ensure that the requested memory size cannot exceed the limit imposed by a
size_t variable. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4357)
This commit is contained in:
parent
f4eb248392
commit
76b2ae8326
@ -207,6 +207,8 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen,
|
|||||||
|
|
||||||
if (maxmem == 0)
|
if (maxmem == 0)
|
||||||
maxmem = SCRYPT_MAX_MEM;
|
maxmem = SCRYPT_MAX_MEM;
|
||||||
|
if (maxmem > SIZE_MAX)
|
||||||
|
maxmem = SIZE_MAX;
|
||||||
|
|
||||||
if (Blen + Vlen > maxmem) {
|
if (Blen + Vlen > maxmem) {
|
||||||
EVPerr(EVP_F_EVP_PBE_SCRYPT, EVP_R_MEMORY_LIMIT_EXCEEDED);
|
EVPerr(EVP_F_EVP_PBE_SCRYPT, EVP_R_MEMORY_LIMIT_EXCEEDED);
|
||||||
|
Loading…
Reference in New Issue
Block a user