From 3e3a508cddeafa0ab81d046a39ed6fc5b0d2ee11 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 18 Jan 2023 14:58:55 +0100 Subject: [PATCH] dnsdist: Gracefully handle a failure to create a TLS server context --- pdns/libssl.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pdns/libssl.cc b/pdns/libssl.cc index 6026bdba3f..4c1fa51174 100644 --- a/pdns/libssl.cc +++ b/pdns/libssl.cc @@ -806,6 +806,11 @@ std::unique_ptr libssl_init_server_context(const TLS { auto ctx = std::unique_ptr(SSL_CTX_new(SSLv23_server_method()), SSL_CTX_free); + if (!ctx) { + ERR_print_errors_fp(stderr); + throw std::runtime_error("Error creating an OpenSSL server context"); + } + int sslOptions = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | -- 2.47.2