diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2013-12-03 09:43:15 +0100 |
---|---|---|
committer | Michael Stapelberg <stapelberg@debian.org> | 2013-12-03 09:43:15 +0100 |
commit | 64d2a7c8945ba05af859901f5e248f1befdd8621 (patch) | |
tree | 013fcb7e9e3296ecdda876012252c36bd6bcb063 /src/pkg/net/dnsclient.go | |
parent | b901efe83e212f0c34c769c079e41373da12d723 (diff) | |
download | golang-64d2a7c8945ba05af859901f5e248f1befdd8621.tar.gz |
Imported Upstream version 1.2upstream/1.2
Diffstat (limited to 'src/pkg/net/dnsclient.go')
-rw-r--r-- | src/pkg/net/dnsclient.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pkg/net/dnsclient.go b/src/pkg/net/dnsclient.go index 76b192645..01db43729 100644 --- a/src/pkg/net/dnsclient.go +++ b/src/pkg/net/dnsclient.go @@ -122,12 +122,9 @@ func isDomainName(s string) bool { if len(s) > 255 { return false } - if s[len(s)-1] != '.' { // simplify checking loop: make name end in dot - s += "." - } last := byte('.') - ok := false // ok once we've seen a letter + ok := false // Ok once we've seen a letter. partlen := 0 for i := 0; i < len(s); i++ { c := s[i] @@ -141,13 +138,13 @@ func isDomainName(s string) bool { // fine partlen++ case c == '-': - // byte before dash cannot be dot + // Byte before dash cannot be dot. if last == '.' { return false } partlen++ case c == '.': - // byte before dot cannot be dot, dash + // Byte before dot cannot be dot, dash. if last == '.' || last == '-' { return false } @@ -158,6 +155,9 @@ func isDomainName(s string) bool { } last = c } + if last == '-' || partlen > 63 { + return false + } return ok } |