]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh: propagate error back in SFTP function
authorDaniel Stenberg <daniel@haxx.se>
Fri, 27 Mar 2026 13:42:25 +0000 (14:42 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 27 Mar 2026 15:12:51 +0000 (16:12 +0100)
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

index 4d64f96ed8f30459e98af6d959d108f2ca183fdf..4fc9ed80416c1fcddbb2c3942abfb1b0c6f106e8 100644 (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;