[openssh-commits] [openssh] 02/04: upstream: clamp the minimum buffer lengths and number of inflight

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Jan 13 14:10:09 AEDT 2023


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 93fc7c576563e3d88a1dc019dd213f65607784cc
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Wed Jan 11 05:39:38 2023 +0000

    upstream: clamp the minimum buffer lengths and number of inflight
    
    requests too
    
    OpenBSD-Commit-ID: c4965f62fa0ba850940fd66ae3f60cf516bbcd56
---
 sftp-client.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sftp-client.c b/sftp-client.c
index 0a5bf03d..e0146481 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-client.c,v 1.167 2023/01/11 05:36:50 djm Exp $ */
+/* $OpenBSD: sftp-client.c,v 1.168 2023/01/11 05:39:38 djm Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm at openbsd.org>
  *
@@ -570,6 +570,8 @@ do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests,
 			    SFTP_MAX_MSG_LENGTH - 1024);
 			ret->upload_buflen = MINIMUM(limits.write_length,
 			    SFTP_MAX_MSG_LENGTH - 1024);
+			ret->download_buflen = MAXIMUM(ret->download_buflen, 64);
+			ret->upload_buflen = MAXIMUM(ret->upload_buflen, 64);
 			debug3("server upload/download buffer sizes "
 			    "%llu / %llu; using %u / %u",
 			    (unsigned long long)limits.write_length,
@@ -581,6 +583,8 @@ do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests,
 		if (num_requests == 0 && limits.open_handles) {
 			ret->num_requests =
 			    MINIMUM(DEFAULT_NUM_REQUESTS, limits.open_handles);
+			if (ret->num_requests == 0)
+				ret->num_requests = 1;
 			debug3("server handle limit %llu; using %u",
 			    (unsigned long long)limits.open_handles,
 			    ret->num_requests);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list