mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-27 13:21:11 +03: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>
This commit is contained in:
committed by
Andreas Schneider
parent
47d21b6420
commit
dbf72ffba2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user