From 72a840b31dd2ffc600dcffec7170eef76d7bb5ee Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Tue, 25 Sep 2018 01:02:31 -0700 Subject: [PATCH] Disallow '/' in file names. A bad rename call could send a path with a '/' to cwfs. This is invalid, and should be disallowed. --- sys/src/cmd/cwfs/sub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/src/cmd/cwfs/sub.c b/sys/src/cmd/cwfs/sub.c index f7f13f2f9..ddb95d7d2 100644 --- a/sys/src/cmd/cwfs/sub.c +++ b/sys/src/cmd/cwfs/sub.c @@ -540,8 +540,8 @@ loop: /* * what are legal characters in a name? * only disallow control characters. - * a) utf avoids control characters. - * b) '/' may not be the separator + * utf avoids control characters, so we + * only need to inspect the ascii range. */ int checkname(char *n) @@ -556,7 +556,7 @@ checkname(char *n) c = n[i] & 0xff; if(c == 0) return 0; - if(c < 040) + if(c < 040 || c == '/') return Ename; } return Etoolong;