summaryrefslogtreecommitdiff
path: root/src/net/dnsconfig_unix.go
diff options
context:
space:
mode:
authorDan Peterson <dpiddy@gmail.com>2016-07-13 10:35:35 -0600
committerMatthew Dempsky <mdempsky@google.com>2016-08-17 15:20:24 +0000
commit2f73fe7a0db269dcbe51e372809032fa52b8c68c (patch)
tree4e6e8026071d50cb9820e4574240885d7327e3e6 /src/net/dnsconfig_unix.go
parent04e76f295f434bf1bd5ef3b01eed42b638a8b321 (diff)
downloadgo-git-2f73fe7a0db269dcbe51e372809032fa52b8c68c.tar.gz
net: use libresolv rules for ndots range and validation
BIND libresolv allows values from 0 to 15. For invalid values and negative numbers, 0 is used. For numbers greater than 15, 15 is used. Fixes #15419 Change-Id: I1009bc119c3e87919bcb55a80a35532e9fc3ba52 Reviewed-on: https://go-review.googlesource.com/24901 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/dnsconfig_unix.go')
-rw-r--r--src/net/dnsconfig_unix.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/net/dnsconfig_unix.go b/src/net/dnsconfig_unix.go
index b885813722..683ae71812 100644
--- a/src/net/dnsconfig_unix.go
+++ b/src/net/dnsconfig_unix.go
@@ -92,8 +92,10 @@ func dnsReadConfig(filename string) *dnsConfig {
switch {
case hasPrefix(s, "ndots:"):
n, _, _ := dtoi(s[6:])
- if n < 1 {
- n = 1
+ if n < 0 {
+ n = 0
+ } else if n > 15 {
+ n = 15
}
conf.ndots = n
case hasPrefix(s, "timeout:"):