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

Hang in sftp_packet_read?


Hi all,

I recognised sftp.c:sftp_packet_read() to hang in case the sftp client
closes the channel. Version under test: 0.7.3.

channel.remote_eof is set to 1, consequently ssh_channel_read() returns
0 causing the do {} while in sftp_packet_read() to loop infinitely.

The patch below solves the problem for me. Could anyone please confirm
or correct me?

Thanks a lot,
--Peter


--- sftp.c	2016-05-13 15:26:20.881799804 +0200
+++ sftp.c.fix	2016-05-13 15:28:35.028430265 +0200
@@ -335,5 +335,5 @@
     // 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);

Follow-Ups:
Re: Hang in sftp_packet_read?Игорь Коваленко <igor.a.kovalenko@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org