summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cwfs
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-09-25 01:02:31 -0700
committerOri Bernstein <ori@eigenstate.org>2018-09-25 01:02:31 -0700
commit72a840b31dd2ffc600dcffec7170eef76d7bb5ee (patch)
treea2bee5b2206adebc445b9def6f8df90adf25249a /sys/src/cmd/cwfs
parent2f076f946fe7a5409cda7d83af5585442b294ec8 (diff)
Disallow '/' in file names.
A bad rename call could send a path with a '/' to cwfs. This is invalid, and should be disallowed.
Diffstat (limited to 'sys/src/cmd/cwfs')
-rw-r--r--sys/src/cmd/cwfs/sub.c6
1 files 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;