mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
sftp: ensure sftp_packet_read recognizes channel EOF to avoid infinite loop
Signed-off-by: Jeremy Cross <jcross@bomgar.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit dbf72ffba2)
This commit is contained in:
committed by
Andreas Schneider
parent
67fe6f56ea
commit
6697f85b50
@@ -334,7 +334,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;
|
||||
|
||||
Reference in New Issue
Block a user