diff options
author | x2018 <xkernel.wang@foxmail.com> | 2021-10-22 22:50:27 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-10-27 08:36:55 +1000 |
commit | 9dddcd90a1350fa63486cbf3226c3eee79f9aff5 (patch) | |
tree | f55ee0a9a4318165e3d40cc6a6e2a0b4db69e6d8 /crypto/dsa | |
parent | 7220085f22cf6c49933ea8287eb15db57f7ab0db (diff) |
add checks for the return values of BN_new(), sk_RSA_PRIME_INFO_new_reserve(),
EVP_PKEY_CTX_new_from_pkey() and EVP_CIPHER_CTX_new().
Otherwise may result in memory errors.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16892)
Diffstat (limited to 'crypto/dsa')
-rw-r--r-- | crypto/dsa/dsa_sign.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/dsa/dsa_sign.c b/crypto/dsa/dsa_sign.c index 6e87bd1657..21b0cbd5fb 100644 --- a/crypto/dsa/dsa_sign.c +++ b/crypto/dsa/dsa_sign.c @@ -65,7 +65,8 @@ DSA_SIG *d2i_DSA_SIG(DSA_SIG **psig, const unsigned char **ppin, long len) sig->r = BN_new(); if (sig->s == NULL) sig->s = BN_new(); - if (ossl_decode_der_dsa_sig(sig->r, sig->s, ppin, (size_t)len) == 0) { + if (sig->r == NULL || sig->s == NULL + || ossl_decode_der_dsa_sig(sig->r, sig->s, ppin, (size_t)len) == 0) { if (psig == NULL || *psig == NULL) DSA_SIG_free(sig); return NULL; |