libssh: propagate error back in SFTP function

The myssh_in_SFTP_READDIR_BOTTOM() function would not store the error
code correctly thus it could be ignored and missed when an error was
returned at that particular moment.

Follow-up to 3c26e6a896

Found by Codex Security

Closes #21122
This commit is contained in:
Daniel Stenberg 2026-03-27 14:42:25 +01:00
parent 86b39c2226
commit ff678be69a
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -519,8 +519,10 @@ static int myssh_in_SFTP_READDIR_BOTTOM(struct Curl_easy *data,
ssh_string_free_char(sshc->readdir_tmp);
sshc->readdir_tmp = NULL;
if(result)
if(result) {
myssh_to(data, sshc, SSH_STOP);
sshc->actualcode = result;
}
else
myssh_to(data, sshc, SSH_SFTP_READDIR);
return SSH_NO_ERROR;