Disallow '/' in file names.

A bad rename call could send a path with a '/' to cwfs.
	This is invalid, and should be disallowed.
This commit is contained in:
Ori Bernstein 2018-09-25 01:02:31 -07:00
parent 2f076f946f
commit 72a840b31d

View file

@ -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;