mirror of
https://github.com/docker/cli.git
synced 2026-09-25 17:02:07 -04:00
Restrict domain name to 255 characters
Signed-off-by: Tomáš Hrčka <thrcka@redhat.com>
Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <princess@docker.com> (github: jfrazelle)
Upstream-commit: 01245d2619
Component: cli
This commit is contained in:
committed by
Vincent Demeester
parent
ccc7b1dd83
commit
6c88b9b6c8
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user