Skip to content

Commit

Permalink
Coverity 1521557: Error handling issues
Browse files Browse the repository at this point in the history
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 #20409)

(cherry picked from commit dd573a2)
  • Loading branch information
paulidale committed Mar 2, 2023
1 parent 2bb9e44 commit 0937c01
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crypto/dsa/dsa_backend.c
Expand Up @@ -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;

Expand Down

0 comments on commit 0937c01

Please sign in to comment.