[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] sftp: ensure sftp_packet_read recognizes channel EOF to avoid infinite loop


Signed-off-by: Jeremy Cross <jcross@xxxxxxxxxx>
---
src/sftp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sftp.c b/src/sftp.c
index f99683d..e34bba0 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -322,7 +322,7 @@ sftp_packet sftp_packet_read(sftp_session sftp) {
   do {
     // read from channel until 4 bytes have been read or an error occurs
     s=ssh_channel_read(sftp->channel, buffer+r, 4-r, 0);
-    if (s < 0) {
+    if (s <= 0) {
       ssh_buffer_free(packet->payload);
       SAFE_FREE(packet);
       return NULL;
--
2.9.0.windows.1

Archive administrator: postmaster@lists.cynapses.org