diff options
author | PW Hu <jlu.hpw@foxmail.com> | 2021-11-05 12:56:50 +0300 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-11-09 10:50:40 +0300 |
commit | 64c428c35053a101a452c42d5d0a9a8342493606 (patch) | |
tree | 2d7692ae87364dcf4650cece043bb4dda249a7d9 /crypto/x509/x509_cmp.c | |
parent | 7267769c28fb90d990a9d789093e83699bf4c5a0 (diff) |
Fix: invoking X509_self_signed improperly
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16976)
Diffstat (limited to 'crypto/x509/x509_cmp.c')
-rw-r--r-- | crypto/x509/x509_cmp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c index 8b4e46a589..f3d58cdfa6 100644 --- a/crypto/x509/x509_cmp.c +++ b/crypto/x509/x509_cmp.c @@ -208,8 +208,12 @@ int X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags) return 1; } } - if ((flags & X509_ADD_FLAG_NO_SS) != 0 && X509_self_signed(cert, 0)) - return 1; + if ((flags & X509_ADD_FLAG_NO_SS) != 0) { + int ret = X509_self_signed(cert, 0); + + if (ret != 0) + return ret > 0 ? 1 : 0; + } if (!sk_X509_insert(sk, cert, (flags & X509_ADD_FLAG_PREPEND) != 0 ? 0 : -1)) { ERR_raise(ERR_LIB_X509, ERR_R_MALLOC_FAILURE); |