diff options
author | Aaron Lehmann <aaron.lehmann@docker.com> | 2015-12-07 17:28:10 -0800 |
---|---|---|
committer | Aaron Lehmann <aaron.lehmann@docker.com> | 2015-12-08 09:54:20 -0800 |
commit | 1ebfa299545e5c2273ce449d72b10745b9e38087 (patch) | |
tree | f9dcaeeabfa546d313f976ad6f3b12507d6cf86b /registry/registry.go | |
parent | 5f1af8da5bd824010d3c744d3adf23106f22c6a9 (diff) | |
download | docker-1ebfa299545e5c2273ce449d72b10745b9e38087.tar.gz |
Add missing bounds in ContinueOnError
ContinueOnError assumes that something of type errcode.Errors contains
at least one error. This is generally true, but might not be true if the
remote registry returns an empty error body or invalid JSON. Add the
bounds check, and in the case where it fails, allow fallbacks to v1.
Fixes #18481
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Diffstat (limited to 'registry/registry.go')
-rw-r--r-- | registry/registry.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/registry/registry.go b/registry/registry.go index 6a0587a237..fc2959a5d5 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -213,6 +213,9 @@ func (e ErrNoSupport) Error() string { func ContinueOnError(err error) bool { switch v := err.(type) { case errcode.Errors: + if len(v) == 0 { + return true + } return ContinueOnError(v[0]) case ErrNoSupport: return ContinueOnError(v.Err) |