diff options
author | Pauli <pauli@openssl.org> | 2022-06-17 11:02:52 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-07-01 16:37:02 +1000 |
commit | 610029c28b7532a69c30ff311c95ddbbdcfaf3fe (patch) | |
tree | 2e4b5ec2be72540d2f3e07df25c5be16247e379d /crypto/dsa | |
parent | 46ac730eed88077a79f83e41cf6d8c5bc5911734 (diff) | |
download | openssl-new-610029c28b7532a69c30ff311c95ddbbdcfaf3fe.tar.gz |
Coverity: fix 1506297: negative returns
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18587)
(cherry picked from commit 3ee2611677e7e9f90e270f3ee4f343c9d3d86835)
Diffstat (limited to 'crypto/dsa')
-rw-r--r-- | crypto/dsa/dsa_ameth.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c index 1da67485e8..482b9e1e0a 100644 --- a/crypto/dsa/dsa_ameth.c +++ b/crypto/dsa/dsa_ameth.c @@ -198,6 +198,11 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) ASN1_STRING_clear_free(prkey); + if (dplen <= 0) { + ERR_raise(ERR_LIB_DSA, DSA_R_BN_ERROR); + goto err; + } + if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dsa), 0, V_ASN1_SEQUENCE, params, dp, dplen)) { OPENSSL_clear_free(dp, dplen); |