]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh: cap SFTP packet size sent
authorJakub Jelen <jjelen@redhat.com>
Tue, 5 Sep 2023 15:33:41 +0000 (17:33 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Sep 2023 14:53:30 +0000 (16:53 +0200)
Due to libssh limitations

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Closes #11804

lib/vssh/libssh.c

index dea0084575859bcb960f315d9b5eea4bec4508f4..7c6a2e53f338fa4115b4abf76e0471533120d242 100644 (file)
@@ -2567,6 +2567,12 @@ static ssize_t sftp_send(struct Curl_easy *data, int sockindex,
   struct connectdata *conn = data->conn;
   (void)sockindex;
 
+  /* limit the writes to the maximum specified in Section 3 of
+   * https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02
+   */
+  if(len > 32768)
+    len = 32768;
+
   nwrite = sftp_write(conn->proto.sshc.sftp_file, mem, len);
 
   myssh_block2waitfor(conn, FALSE);