Skip to content

Commit

Permalink
sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Nov 19, 2024
1 parent 2dc084a commit e3e8870
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/dpp/sslclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit e3e8870

Please sign in to comment.