wgengine/wgcfg: fix validateEndpoints of empty string

Updates tailscale/corp#1238
This commit is contained in:
Brad Fitzpatrick
2021-01-30 11:17:55 -08:00
parent 914a486af6
commit 761188e5d2
2 changed files with 23 additions and 1 deletions
+5 -1
View File
@@ -22,10 +22,14 @@ type ParseError struct {
}
func (e *ParseError) Error() string {
return fmt.Sprintf("%s: %s", e.why, e.offender)
return fmt.Sprintf("%s: %q", e.why, e.offender)
}
func validateEndpoints(s string) error {
if s == "" {
// Otherwise strings.Split of the empty string produces [""].
return nil
}
vals := strings.Split(s, ",")
for _, val := range vals {
_, _, err := parseEndpoint(val)