mirror of https://github.com/openssl/openssl.git
Fix coverity-1604666
Coverity recently flaged an error in which the return value for
EVP_MD_get_size wasn't checked for negative values prior to use, which
can cause underflow later in the function.
Just add the check and error out if get_size returns an error.
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24896)
(cherry picked from commit 22e08c7cdc)
This commit is contained in:
parent
05590a929f
commit
79ab705b70
|
|
@ -186,7 +186,7 @@ int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,
|
||||||
|
|
||||||
mdlen = EVP_MD_get_size(md);
|
mdlen = EVP_MD_get_size(md);
|
||||||
|
|
||||||
if (tlen <= 0 || flen <= 0)
|
if (tlen <= 0 || flen <= 0 || mdlen <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
/*
|
/*
|
||||||
* |num| is the length of the modulus; |flen| is the length of the
|
* |num| is the length of the modulus; |flen| is the length of the
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue