[openssh-commits] [openssh] 01/01: upstream: scp: when copying local->remote, check that source file

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Mar 27 14:28:13 AEDT 2023


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

djm pushed a commit to branch master
in repository openssh.

commit 4f0a676486700f10a4788f7e9426e94e39c1c89e
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Mon Mar 27 03:25:08 2023 +0000

    upstream: scp: when copying local->remote, check that source file
    
    exists before opening SFTP connection to the server. Based on GHPR#370 ok
    dtucker, markus
    
    OpenBSD-Commit-ID: b4dd68e15bfe22ce4fac9960a1066a2b721e54fb
---
 scp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scp.c b/scp.c
index a893d4a2..470b4f46 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.253 2023/03/03 03:12:24 dtucker Exp $ */
+/* $OpenBSD: scp.c,v 1.254 2023/03/27 03:25:08 djm Exp $ */
 /*
  * scp - secure remote copy.  This is basically patched BSD rcp which
  * uses ssh to do the data transfer (instead of using rcmd).
@@ -1036,6 +1036,7 @@ toremote(int argc, char **argv, enum scp_mode_e mode, char *sftp_direct)
 	struct sftp_conn *conn = NULL, *conn2 = NULL;
 	arglist alist;
 	int i, r, status;
+	struct stat sb;
 	u_int j;
 
 	memset(&alist, '\0', sizeof(alist));
@@ -1178,6 +1179,11 @@ toremote(int argc, char **argv, enum scp_mode_e mode, char *sftp_direct)
 				errs = 1;
 		} else {	/* local to remote */
 			if (mode == MODE_SFTP) {
+				/* no need to glob: already done by shell */
+				if (stat(argv[i], &sb) != 0) {
+					fatal("stat local \"%s\": %s", argv[i],
+					    strerror(errno));
+				}
 				if (remin == -1) {
 					/* Connect to remote now */
 					conn = do_sftp_connect(thost, tuser,

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


More information about the openssh-commits mailing list