From ff678be69a57ee9809adf37d759f8826507ffe0a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 27 Mar 2026 14:42:25 +0100 Subject: [PATCH] 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 3c26e6a896247ccf872d3f1 Found by Codex Security Closes #21122 --- lib/vssh/libssh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 4d64f96ed8..4fc9ed8041 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -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;