diff options
author | Pauli <pauli@openssl.org> | 2021-08-17 13:19:32 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-08-18 16:12:35 +1000 |
commit | 9d868840b821fddf895e3bf6b589ecf6be7b1b13 (patch) | |
tree | 879e1a489e69d1e78e4a9ecfb439b19e40e83913 /crypto | |
parent | bc8c36272067f8443f875164831ce3a5a739df3f (diff) |
pkcs12: check for zero length digest to avoid division by zero
Fixes #16331
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/16333)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/pkcs12/p12_key.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/pkcs12/p12_key.c b/crypto/pkcs12/p12_key.c index ab31a61295..b814f79216 100644 --- a/crypto/pkcs12/p12_key.c +++ b/crypto/pkcs12/p12_key.c @@ -101,7 +101,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, #endif v = EVP_MD_block_size(md_type); u = EVP_MD_size(md_type); - if (u < 0 || v <= 0) + if (u <= 0 || v <= 0) goto err; D = OPENSSL_malloc(v); Ai = OPENSSL_malloc(u); |