1
0
mirror of https://github.com/docker/cli.git synced 2026-01-18 08:21:31 +03:00

Merge pull request #11260 from jfrazelle/carry-domain-255

Restrict domain name to 255 characters
Upstream-commit: 6ffc57ad5c8233bcc1360ec73096cc5049ed4062
Component: engine
This commit is contained in:
Tibor Vass
2015-03-09 14:09:37 -04:00
2 changed files with 2 additions and 1 deletions

View File

@@ -211,7 +211,7 @@ func validateDomain(val string) (string, error) {
return "", fmt.Errorf("%s is not a valid domain", val)
}
ns := domainRegexp.FindSubmatch([]byte(val))
if len(ns) > 0 {
if len(ns) > 0 && len(ns[1]) < 255 {
return string(ns[1]), nil
}
return "", fmt.Errorf("%s is not a valid domain", val)

View File

@@ -105,6 +105,7 @@ func TestValidateDnsSearch(t *testing.T) {
`foo.bar-.baz`,
`foo.-bar`,
`foo.-bar.baz`,
`foo.bar.baz.this.should.fail.on.long.name.beause.it.is.longer.thanisshouldbethis.should.fail.on.long.name.beause.it.is.longer.thanisshouldbethis.should.fail.on.long.name.beause.it.is.longer.thanisshouldbethis.should.fail.on.long.name.beause.it.is.longer.thanisshouldbe`,
}
for _, domain := range valid {