From e3e8870e0983d6f18fcd92afe1e8bab640e6d6e3 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Tue, 19 Nov 2024 12:51:11 +0000 Subject: [PATCH] sanity checks --- src/dpp/sslclient.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dpp/sslclient.cpp b/src/dpp/sslclient.cpp index 934e1e0103..3e9d24862b 100644 --- a/src/dpp/sslclient.cpp +++ b/src/dpp/sslclient.cpp @@ -255,6 +255,9 @@ void ssl_client::log(dpp::loglevel severity, const std::string &msg) const void ssl_client::complete_handshake(const socket_events* ev) { + if (!ssl || !ssl->ssl) { + return; + } auto status = SSL_do_handshake(ssl->ssl); if (status != 1) { auto code = SSL_get_error(ssl->ssl, status); @@ -306,7 +309,7 @@ void ssl_client::on_read(socket fd, const struct socket_events& ev) { return; } bytes_in += r; - } else if (!plaintext && connected) { + } else if (!plaintext && connected && ssl && ssl->ssl) { int r = SSL_read(ssl->ssl, server_to_client_buffer, DPP_BUFSIZE); int e = SSL_get_error(ssl->ssl,r); @@ -440,7 +443,7 @@ void ssl_client::on_write(socket fd, const struct socket_events& e) { se.flags = WANT_READ | WANT_WRITE | WANT_ERROR; owner->socketengine->update_socket(se); } - } else { + } else if (ssl && ssl->ssl) { int r = SSL_write(ssl->ssl, client_to_server_buffer + client_to_server_offset, (int)client_to_server_length); int err = SSL_get_error(ssl->ssl, r);