scp: disallow empty or current directory
Obtained from: OpenBSD scp.c 1.198 Security: CVE-2018-20685 Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
10d58df29f
commit
6ab515da5a
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user