summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-04-27 09:32:14 +1000
committerPauli <paul.dale@oracle.com>2020-04-30 20:21:33 +1000
commit64e54bf5c6657bf423d3ba463f31095d598d94e7 (patch)
treedfef8056f422b10f2f97da80be37e3da7a93734d /ssl
parent206da660a37e84b7266db4e2c4e9485cdafb1366 (diff)
coverity 1462581 Dereference after null check
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11651)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/ssl_cert.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index 51bfa439f0..408404958e 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -872,7 +872,10 @@ int ssl_build_cert_chain(SSL *s, SSL_CTX *ctx, int flags)
untrusted = cpk->chain;
}
- xs_ctx = X509_STORE_CTX_new_with_libctx(s->ctx->libctx, s->ctx->propq);
+ if (s == NULL)
+ xs_ctx = X509_STORE_CTX_new_with_libctx(ctx->libctx, ctx->propq);
+ else
+ xs_ctx = X509_STORE_CTX_new_with_libctx(s->ctx->libctx, s->ctx->propq);
if (xs_ctx == NULL) {
SSLerr(SSL_F_SSL_BUILD_CERT_CHAIN, ERR_R_MALLOC_FAILURE);
goto err;