summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHaelwenn Monnier <contact+github.com@hacktivis.me>2020-05-25 14:54:29 +0200
committerGitHub <noreply@github.com>2020-05-25 20:54:29 +0800
commit8f8a3dff705fad774a10864a2e3dbcfa9779ceff (patch)
treed5c70954d1041aa8dedccfd30dc3772ef3672bb9
parent90cfbe1f7a8138225c08a43a62ffe5a064a6297e (diff)
scp.c: Port OpenSSH CVE-2018-20685 fix (#80)
-rw-r--r--scp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/scp.c b/scp.c
index 742ae00..7b8e7d2 100644
--- a/scp.c
+++ b/scp.c
@@ -935,7 +935,8 @@ sink(int argc, char **argv)
size = size * 10 + (*cp++ - '0');
if (*cp++ != ' ')
SCREWUP("size not delimited");
- 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);
}