From e48f925bda648d00b2691c64227fd70e42a748a3 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 7 Apr 2017 17:08:54 +0200 Subject: [PATCH] Fix tini version parsing Invalid version strings for the init (tini) binary were still accepted, which lead to (e.g.) "hello world" Being used as "vhello world" This makes the version parsing slightly stricter Signed-off-by: Sebastiaan van Stijn Upstream-commit: 984d99e19cd5fbc6889528c9588f4875e3c40cc5 Component: engine --- components/engine/daemon/info_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/daemon/info_unix.go b/components/engine/daemon/info_unix.go index e60a06a006..ddbd7523d5 100644 --- a/components/engine/daemon/info_unix.go +++ b/components/engine/daemon/info_unix.go @@ -69,7 +69,7 @@ func (daemon *Daemon) FillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo) v.InitCommit.Expected = dockerversion.InitCommitID[0:len(v.InitCommit.ID)] } } - if v.InitCommit.ID == "" && len(parts) >= 1 { + if v.InitCommit.ID == "" && strings.HasPrefix(parts[0], "tini version") { vs := strings.TrimPrefix(parts[0], "tini version ") v.InitCommit.ID = "v" + vs }