瀏覽代碼

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
Evangelos Pappas 7 年之前
父節點
當前提交
7a59a9380e
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      cmd/utils/flags.go

+ 1 - 1
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