From 2e377fdeea94f753dd7031a96c2d13cc3b2b6eed Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 1 Apr 2019 10:34:27 +0200 Subject: conf: forbid special characters as netshell.dll does --- conf/name.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'conf') diff --git a/conf/name.go b/conf/name.go index da9928e0..a4a599f9 100644 --- a/conf/name.go +++ b/conf/name.go @@ -16,6 +16,7 @@ var reservedNames = []string{ "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", } +const netshellDllForbidden = "\\/:*?\"<>|\t" const specialChars = "/\\<>:\"|?*\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x00" var allowedNameFormat *regexp.Regexp @@ -37,7 +38,7 @@ func isReserved(name string) bool { } func hasSpecialChars(name string) bool { - return strings.ContainsAny(name, specialChars) + return strings.ContainsAny(name, specialChars) || strings.ContainsAny(name, netshellDllForbidden) } func TunnelNameIsValid(name string) bool { -- cgit v1.2.3-59-g8ed1b