Coverity 1521557: Error handling issues

Check the return from DSA_set0_key and generate an error on failure.
Technically a false positive since the function always returns success.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/20409)

(cherry picked from commit dd573a2fc1)
This commit is contained in:
Pauli 2023-03-01 12:22:49 +11:00
parent 2bb9e44520
commit 0937c01f2e
1 changed files with 4 additions and 1 deletions

View File

@ -173,7 +173,10 @@ DSA *ossl_dsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf,
ERR_raise(ERR_LIB_DSA, DSA_R_BN_ERROR);
goto dsaerr;
}
DSA_set0_key(dsa, dsa_pubkey, dsa_privkey);
if (!DSA_set0_key(dsa, dsa_pubkey, dsa_privkey)) {
ERR_raise(ERR_LIB_DSA, ERR_R_INTERNAL_ERROR);
goto dsaerr;
}
goto done;