Merge pull request #1603 from bmuller/require-valid-port

Require a valid port that isn't greater than 65,535
This commit is contained in:
Travis Turner 2018-08-17 08:27:12 -05:00 committed by GitHub
commit f0baba9f23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

3
uri.go
View file

@ -173,6 +173,9 @@ func parseAddress(address string) (uri *URI, err error) {
if err != nil {
return nil, errors.New("converting port string to int")
}
if port > 65535 {
return nil, errors.New("port must be in range 0 - 65535")
}
}
uri = &URI{
Scheme: scheme,

View file

@ -172,5 +172,5 @@ func validFixture() []uriItem {
}
func invalidFixture() []string {
return []string{"foo:bar", "http://foo:", "foo:", ":bar", "http://pilosa.com:129999999999999999999999993", "fd42:4201:f86b:7e09:216:3eff:fefa:ed80"}
return []string{"foo:bar", "http://foo:", "foo:", ":bar", "http://pilosa.com:129999999999999999999999993", "fd42:4201:f86b:7e09:216:3eff:fefa:ed80", ":65536"}
}