From: Daniel Stenberg Date: Fri, 19 Sep 2025 11:35:23 +0000 (+0200) Subject: libssh: react on errors from ssh_scp_read X-Git-Tag: rc-8_17_0-1~343 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4f5528675a1bc1008748c3c0f636ab4c1ec6d9c0;p=thirdparty%2Fcurl.git libssh: react on errors from ssh_scp_read Reported in Joshua's sarif data Closes #18616 --- diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 695532ff85..2554468c4b 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -2889,7 +2889,7 @@ static CURLcode scp_recv(struct Curl_easy *data, int sockindex, { struct connectdata *conn = data->conn; struct ssh_conn *sshc = Curl_conn_meta_get(conn, CURL_META_SSH_CONN); - ssize_t nread; + int nread; (void)sockindex; /* we only support SCP on the fixed known primary socket */ *pnread = 0; @@ -2899,7 +2899,8 @@ static CURLcode scp_recv(struct Curl_easy *data, int sockindex, /* libssh returns int */ nread = ssh_scp_read(sshc->scp_session, mem, len); - + if(nread == SSH_ERROR) + return CURLE_SSH; #if 0 /* The following code is misleading, mostly added as wishful thinking * that libssh at some point will implement non-blocking ssh_scp_write/read.