summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-11-16 03:03:10 +0000
committerColin Watson <cjwatson@debian.org>2019-01-12 18:46:27 +0000
commitdee21e97428e69d30e2d15c71f3e7cc08bf8e4f8 (patch)
tree90f022f959856ef83fbd42acfca0737973181ed4
parent1d2a55436d4b556269f42ad5f7e16608b5a8ed74 (diff)
upstream: disallow empty incoming filename or ones that refer to the
current directory; based on report/patch from Harry Sintonen OpenBSD-Commit-ID: f27651b30eaee2df49540ab68d030865c04f6de9 Origin: upstream, https://anongit.mindrot.org/openssh.git/commit/?id=6010c0303a422a9c5fa8860c061bf7105eb7f8b2 Bug-Debian: https://bugs.debian.org/919101 Last-Update: 2019-01-12 Patch-Name: scp-disallow-dot-or-empty-filename.patch
-rw-r--r--scp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/scp.c b/scp.c
index ed2864250..7163d33dc 100644
--- a/scp.c
+++ b/scp.c
@@ -1114,7 +1114,8 @@ sink(int argc, char **argv)
1114 SCREWUP("size out of range"); 1114 SCREWUP("size out of range");
1115 size = (off_t)ull; 1115 size = (off_t)ull;
1116 1116
1117 if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) { 1117 if (*cp == '\0' || strchr(cp, '/') != NULL ||
1118 strcmp(cp, ".") == 0 || strcmp(cp, "..") == 0) {
1118 run_err("error: unexpected filename: %s", cp); 1119 run_err("error: unexpected filename: %s", cp);
1119 exit(1); 1120 exit(1);
1120 } 1121 }