From c8080eb22362630b7a735d30da55dd23779cd83c Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 31 May 2024 22:33:07 +0200 Subject: Handle SSL_ERROR_ZERO_RETURN in OpenSSL It may be returned when the server closes the connection, see: https://www.openssl.org/docs/manmaster/man3/SSL_get_error.html We simply handle it as if there was no error and return zero bytes read. Fixes: https://github.com/dillo-browser/dillo/issues/175 --- ChangeLog | 2 ++ src/IO/tls_openssl.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9026442f..f073f389 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ dillo-3.1.1 [not released yet] +- Disable TLSv1.3 in Mbed TLS 3.6.0 until it is supported. - Add workaround for Cygwin and OpenSSL with --disable-threaded-dns. - Fix distcheck when HTML tests are enabled. + - Fix an OpenSSL bug when the server closes the connection prematurely and + SSL_get_error() returns SSL_ERROR_ZERO_RETURN. Patches: Rodrigo Arias Mallo +- Add HTML tests to the distributed tarball. Patches: Matt Jolly diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c index 90be78b7..3e53800d 100644 --- a/src/IO/tls_openssl.c +++ b/src/IO/tls_openssl.c @@ -1277,6 +1277,9 @@ static int Tls_handle_error(Conn_t *conn, int ret, const char *where) if (err1_ret == SSL_ERROR_NONE) { errno = 0; return ret; + } else if (err1_ret == SSL_ERROR_ZERO_RETURN) { + errno = 0; + return 0; } else if (err1_ret == SSL_ERROR_WANT_READ || err1_ret == SSL_ERROR_WANT_WRITE) { errno = EAGAIN; return -1; -- cgit v1.2.3