summaryrefslogtreecommitdiff
path: root/methods/connect.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2025-06-15 16:49:22 +0200
committerJulian Andres Klode <jak@debian.org>2025-06-24 16:52:46 +0000
commit2c889aca1b3f792797753d73a94bc0c6f269f526 (patch)
tree18574ad1aaeec51c86f43cb2b8d74b76ef44a611 /methods/connect.cc
parentb0f13098c2e09555f878eea102d275acbcad6755 (diff)
tls: Do not trigger assertion after closing connection
In HasPending(), we assert that there is an open connection object (ssl), but it seems we can end up calling HasPending() after calling Close(). Therefore, remove the assertion and include ssl != nullptr as the first requirement. Closes: #1107827
Diffstat (limited to 'methods/connect.cc')
-rw-r--r--methods/connect.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/methods/connect.cc b/methods/connect.cc
index 96c169e79..828be3f50 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -889,12 +889,11 @@ struct TlsFd final : public MethodFd
bool HasPending() override
{
- assert(ssl);
// SSL_has_pending() can return 1 even if there are no actual bytes to read
// post decoding, so we need to SSL_peek() too to see if there are actual
// bytes as otherwise we end up busy looping (tested by DE -> AU https connection)
char buf;
- return SSL_has_pending(ssl) && SSL_peek(ssl, &buf, 1) > 0;
+ return ssl != nullptr && SSL_has_pending(ssl) && SSL_peek(ssl, &buf, 1) > 0;
}
};