cmd/utils: handle git commit a bit safer for user specified strings (#15790)

* cmd/utils/flags.go: Applying a String len guard for the gitCommit param of the NewApp()

* cmd/utils: remove redundant clause in if condition
This commit is contained in:
Evangelos Pappas 2018-01-03 16:18:53 +00:00 committed by Péter Szilágyi
parent 762f3a48a0
commit 7a59a9380e

View File

@ -96,7 +96,7 @@ func NewApp(gitCommit, usage string) *cli.App {
//app.Authors = nil //app.Authors = nil
app.Email = "" app.Email = ""
app.Version = params.Version app.Version = params.Version
if gitCommit != "" { if len(gitCommit) >= 8 {
app.Version += "-" + gitCommit[:8] app.Version += "-" + gitCommit[:8]
} }
app.Usage = usage app.Usage = usage