X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Fssl_cert.c;h=408404958efb3576599487c72ffb4171e621886e;hp=51bfa439f0edadfc0825260f56a0900ef2523872;hb=64e54bf5c6657bf423d3ba463f31095d598d94e7;hpb=852c2ed260860b6b85c84f9fe96fb4d23d49c9f2 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;