Browse code

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 <github@gone.nl>

Sebastiaan van Stijn authored on 2017/04/08 00:08:54
Showing 1 changed files
... ...
@@ -69,7 +69,7 @@ func (daemon *Daemon) FillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo)
69 69
 				v.InitCommit.Expected = dockerversion.InitCommitID[0:len(v.InitCommit.ID)]
70 70
 			}
71 71
 		}
72
-		if v.InitCommit.ID == "" && len(parts) >= 1 {
72
+		if v.InitCommit.ID == "" && strings.HasPrefix(parts[0], "tini version") {
73 73
 			vs := strings.TrimPrefix(parts[0], "tini version ")
74 74
 			v.InitCommit.ID = "v" + vs
75 75
 		}