Only allo a-zA-Z0-9_ in filenames.

Thanks Od1n for reporting this.
master
Christoph Lohmann 2021-06-13 14:00:52 +02:00
parent d56297fed5
commit ad95b9aa56
1 changed files with 11 additions and 14 deletions

View File

@ -62,23 +62,20 @@ void
escapechars(char *s) escapechars(char *s)
{ {
for (; *s; s++) { for (; *s; s++) {
switch (*s) { if (*s == '\n') {
case '#':
case ' ':
case '\t':
case ':':
case '.':
case '(':
case ')':
case '/':
*s = '_';
break;
case '\n':
*s = '\0'; *s = '\0';
return; return;
default:
break;
} }
/*
* Only allow ASCII printable a-zA-Z0-9 for simplicity.
*/
if ((*s >= 'a' && *s <= 'z')
|| (*s >= 'A' && *s <= 'Z')
|| (*s >= '0' && *s <= '9')) {
continue;
}
*s = '_';
} }
} }