aboutsummaryrefslogtreecommitdiffstats
path: root/conf
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-01 10:34:27 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-01 10:34:27 +0200
commit2e377fdeea94f753dd7031a96c2d13cc3b2b6eed (patch)
tree0adee706e1eddcdcf264790bfd3b0c77e6ae74aa /conf
parentui: abstract test interface name (diff)
downloadwireguard-windows-2e377fdeea94f753dd7031a96c2d13cc3b2b6eed.tar.xz
wireguard-windows-2e377fdeea94f753dd7031a96c2d13cc3b2b6eed.zip
conf: forbid special characters as netshell.dll does
Diffstat (limited to 'conf')
-rw-r--r--conf/name.go3
1 files changed, 2 insertions, 1 deletions
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 {