aboutsummaryrefslogtreecommitdiff
path: root/core/parse/parsing.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-04-13 23:23:35 +0100
committerGravatar Miek Gieben <miek@miek.nl> 2016-04-13 23:23:35 +0100
commit8184328dbade8834720c61ecf466b722eac46bb7 (patch)
treea0110ae14e7b6946dce0cec80327bf59fa787a95 /core/parse/parsing.go
parentda447e28f494c47c5212f0e045ba8c3c065f45fb (diff)
downloadcoredns-8184328dbade8834720c61ecf466b722eac46bb7.tar.gz
coredns-8184328dbade8834720c61ecf466b722eac46bb7.tar.zst
coredns-8184328dbade8834720c61ecf466b722eac46bb7.zip
Use IsDomainName (#119)
Liberal as it as it still has its use. Reject invalid domain names in the config. Unrelated: clear up the README as well. And fix travis script.
Diffstat (limited to 'core/parse/parsing.go')
-rw-r--r--core/parse/parsing.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/parse/parsing.go b/core/parse/parsing.go
index 6e73bd584..712695b22 100644
--- a/core/parse/parsing.go
+++ b/core/parse/parsing.go
@@ -1,6 +1,7 @@
package parse
import (
+ "fmt"
"net"
"os"
"path/filepath"
@@ -320,6 +321,14 @@ func standardAddress(str string) (address, error) {
// no error check here; return err at end of function
}
+ if len(host) > 255 {
+ return address{}, fmt.Errorf("specified address is too long: %d > 255", len(host))
+ }
+ _, d := dns.IsDomainName(host)
+ if !d {
+ return address{}, fmt.Errorf("host is not a valid domain: %s", host)
+ }
+
// see if we can set port based off scheme
if port == "" {
port = "53"