1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-08 03:42:12 +03:00

sftp.c: call ssh_set_error

Since sftp_init() returns 0 on success, < 0 on error with ssh error set. This
change sets the appropriate ssh error when the SSH_FXP_VERSION packet cannot be
unpacked and sftp_init() return with -1.

Signed-off-by: Ajit Singh <ajeetsinghchahar2@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Ajit Singh
2024-04-02 05:24:30 +05:30
committed by Jakub Jelen
parent 996037e77b
commit 4a83c50ce9

View File

@@ -464,7 +464,10 @@ int sftp_init(sftp_session sftp)
/* TODO: are we sure there are 4 bytes ready? */
rc = ssh_buffer_unpack(packet->payload, "d", &version);
if (rc != SSH_OK){
if (rc != SSH_OK) {
ssh_set_error(sftp->session,
SSH_FATAL,
"Unable to unpack SSH_FXP_VERSION packet");
sftp_set_error(sftp, SSH_FX_FAILURE);
return -1;
}