libssh2_sftp_read should not return error if it receives SSH_FX_EOF code in
SSH_FXP_STATUS packet. (Thanks to elifantu@mail.ru for the patch)
This commit is contained in:
parent
2a48f54937
commit
f29f85f482
13
src/sftp.c
13
src/sftp.c
@ -712,11 +712,18 @@ static ssize_t _libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle,
|
|||||||
|
|
||||||
switch (data[0]) {
|
switch (data[0]) {
|
||||||
case SSH_FXP_STATUS:
|
case SSH_FXP_STATUS:
|
||||||
sftp->last_errno = libssh2_ntohu32(data + 5);
|
{
|
||||||
libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
|
int retcode = libssh2_ntohu32(data + 5);
|
||||||
"SFTP Protocol Error", 0);
|
|
||||||
LIBSSH2_FREE(session, data);
|
LIBSSH2_FREE(session, data);
|
||||||
|
|
||||||
|
if (retcode == LIBSSH2_FX_EOF) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
sftp->last_errno = retcode;
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, "SFTP Protocol Error", 0);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
case SSH_FXP_DATA:
|
case SSH_FXP_DATA:
|
||||||
bytes_read = libssh2_ntohu32(data + 5);
|
bytes_read = libssh2_ntohu32(data + 5);
|
||||||
if (bytes_read > (data_len - 9)) {
|
if (bytes_read > (data_len - 9)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user