1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
From 7ded74876ff287a4d6d8a12d933e003b61f6488a Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 15 Nov 2018 08:58:08 +0100
Subject: [PATCH] Fix #77151 ftp_close(): SSL_read on shutdown
Regression introduced in fix for #76972
---
ext/ftp/ftp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 88553b969c29..a7d5ebbea13c 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -1770,10 +1770,10 @@ static void ftp_ssl_shutdown(ftpbuf_t *ftp, php_socket_t fd, SSL *ssl_handle) {
done = 0;
}
- while (!done) {
- if (data_available(ftp, fd)) {
- ERR_clear_error();
- nread = SSL_read(ssl_handle, buf, sizeof(buf));
+ while (!done && data_available(ftp, fd)) {
+ ERR_clear_error();
+ nread = SSL_read(ssl_handle, buf, sizeof(buf));
+ if (nread <= 0) {
err = SSL_get_error(ssl_handle, nread);
switch (err) {
case SSL_ERROR_NONE: /* this is not an error */
|