Permalink
Browse files

scp: disallow empty or current directory

Obtained from:	OpenBSD scp.c 1.198
Security:	CVE-2018-20685
Sponsored by:	The FreeBSD Foundation
  • Loading branch information...
emaste committed Jan 15, 2019
1 parent 10d58df commit 6ab515da5ab2c4969a4ee5a4e7f87030109f252d
Showing with 2 additions and 1 deletion.
  1. +2 −1 crypto/openssh/scp.c
@@ -1106,7 +1106,8 @@ sink(int argc, char **argv)
SCREWUP("size out of range");
size = (off_t)ull;

if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) {
if (*cp == '\0' || strchr(cp, '/') != NULL ||
strcmp(cp, ".") == 0 || strcmp(cp, "..") == 0) {
run_err("error: unexpected filename: %s", cp);
exit(1);
}

0 comments on commit 6ab515d

Please sign in to comment.