Skip to content

Commit

Permalink
Fix nil pointer deref in dump-snapshot --redacted
Browse files Browse the repository at this point in the history
container.PullOptions is nil if the service is deployed without
`--with-registry-auth`.  Observed on client+server 19.03.2.

Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
  • Loading branch information
Trapier Marshall committed Sep 20, 2019
1 parent a8bbe7d commit a4e520a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/swarm-rafttool/dump.go
Expand Up @@ -200,15 +200,19 @@ func dumpSnapshot(swarmdir, unlockKey string, redact bool) error {
if task != nil {
if container := task.Spec.GetContainer(); container != nil {
container.Env = []string{"ENVVARS REDACTED"}
container.PullOptions.RegistryAuth = "REDACTED"
if container.PullOptions != nil {
container.PullOptions.RegistryAuth = "REDACTED"
}
}
}
}
for _, service := range s.Store.Services {
if service != nil {
if container := service.Spec.Task.GetContainer(); container != nil {
container.Env = []string{"ENVVARS REDACTED"}
container.PullOptions.RegistryAuth = "REDACTED"
if container.PullOptions != nil {
container.PullOptions.RegistryAuth = "REDACTED"
}
}
}
}
Expand Down

0 comments on commit a4e520a

Please sign in to comment.