From 7a59a9380e9f12729bb094de4151c3d135bdadf9 Mon Sep 17 00:00:00 2001 From: Evangelos Pappas Date: Wed, 3 Jan 2018 16:18:53 +0000 Subject: [PATCH] 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 --- cmd/utils/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 734cf6f36..edf3dc2c2 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -96,7 +96,7 @@ func NewApp(gitCommit, usage string) *cli.App { //app.Authors = nil app.Email = "" app.Version = params.Version - if gitCommit != "" { + if len(gitCommit) >= 8 { app.Version += "-" + gitCommit[:8] } app.Usage = usage