summaryrefslogtreecommitdiff
path: root/ext/openssl/xp_ssl.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-11-05 12:13:46 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-11-05 12:13:46 +0100
commit4f984a2fdb3815361f83013c23af0ff5d6d63d67 (patch)
tree472d0e58594dda71037b29c1eab44c94e02b278f /ext/openssl/xp_ssl.c
parente29922f054639a934f3077190729007896ae244c (diff)
downloadphp-git-4f984a2fdb3815361f83013c23af0ff5d6d63d67.tar.gz
Fixed bug #78775
Clear the OpenSSL error queue before performing SSL stream operations. As we don't control all code that could possibly be using OpenSSL, we can't rely on the error queue being empty.
Diffstat (limited to 'ext/openssl/xp_ssl.c')
-rw-r--r--ext/openssl/xp_ssl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 3df1a1889a..36939de8fe 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -1873,6 +1873,7 @@ static int php_openssl_enable_crypto(php_stream *stream,
do {
struct timeval cur_time, elapsed_time;
+ ERR_clear_error();
if (sslsock->is_client) {
n = SSL_connect(sslsock->ssl_handle);
} else {
@@ -2045,6 +2046,7 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz
}
/* Now, do the IO operation. Don't block if we can't complete... */
+ ERR_clear_error();
if (read) {
nr_bytes = SSL_read(sslsock->ssl_handle, buf, (int)count);