Only allow * and ? as entire DNS name labels

This commit is contained in:
Andrew Ayer 2016-04-29 08:45:54 -07:00
parent 2c9df274e9
commit ec68dde647
1 changed files with 4 additions and 2 deletions

View File

@ -73,10 +73,12 @@ func isValidDNSLabelChar (ch rune) bool {
return (ch >= 'A' && ch <= 'Z') ||
(ch >= 'a' && ch <= 'z') ||
(ch >= '0' && ch <= '9') ||
ch == '-' || ch == '_' ||
ch == '*' || ch == '?';
ch == '-' || ch == '_';
}
func isValidDNSLabel (label string) bool {
if label == "*" || label == "?" {
return true
}
for _, ch := range label {
if !isValidDNSLabelChar(ch) {
return false