summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2020-05-20 22:14:59 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2020-05-20 22:14:59 +0100
commitb87042e8b8d47ccc76b7873fc8c6afd5ab64508e (patch)
treee29e740b1a1d2c5fc4d6c5383bf8ecab4325dabc
parent666eb084c9925c35d1e30d2809f04fcb57802a32 (diff)
OpenSSL: clear error stack before avery I/O operation
-rw-r--r--src/src/tls-openssl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c
index 0caf1c0ff..8c9d8aa69 100644
--- a/src/src/tls-openssl.c
+++ b/src/src/tls-openssl.c
@@ -3458,6 +3458,7 @@ int inbytes;
DEBUG(D_tls) debug_printf("Calling SSL_read(%p, %p, %u)\n", server_ssl,
ssl_xfer_buffer, ssl_xfer_buffer_size);
+ERR_clear_error();
if (smtp_receive_timeout > 0) ALARM(smtp_receive_timeout);
inbytes = SSL_read(server_ssl, CS ssl_xfer_buffer,
MIN(ssl_xfer_buffer_size, lim));
@@ -3607,6 +3608,7 @@ int error;
DEBUG(D_tls) debug_printf("Calling SSL_read(%p, %p, %u)\n", ssl,
buff, (unsigned int)len);
+ERR_clear_error();
inbytes = SSL_read(ssl, CS buff, len);
error = SSL_get_error(ssl, inbytes);
@@ -3696,6 +3698,7 @@ if ((more || corked))
for (int left = len; left > 0;)
{
DEBUG(D_tls) debug_printf("SSL_write(%p, %p, %d)\n", ssl, buff, left);
+ ERR_clear_error();
outbytes = SSL_write(ssl, CS buff, left);
error = SSL_get_error(ssl, outbytes);
DEBUG(D_tls) debug_printf("outbytes=%d error=%d\n", outbytes, error);