From 6209f66f007f22b2c63cf1f11d43aab847702490 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 6 Apr 2001 16:47:00 +0000 Subject: remove trailing / from source paths; fixes pr#1756 --- usr.bin/ssh/scp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr.bin/ssh/scp.c') diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index b42b9be62cb..a19a19d6b46 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/scp.c @@ -75,7 +75,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: scp.c,v 1.64 2001/03/28 20:04:38 stevesk Exp $"); +RCSID("$OpenBSD: scp.c,v 1.65 2001/04/06 16:46:59 deraadt Exp $"); #include "xmalloc.h" #include "atomicio.h" @@ -483,10 +483,14 @@ source(argc, argv) off_t i; int amt, fd, haderr, indx, result; char *last, *name, buf[2048]; + int len; for (indx = 0; indx < argc; ++indx) { name = argv[indx]; statbytes = 0; + len = strlen(name); + while (len > 1 && name[len-1] == '/') + name[--len] = '\0'; if ((fd = open(name, O_RDONLY, 0)) < 0) goto syserr; if (fstat(fd, &stb) < 0) { -- cgit v1.2.3