added arg length check to prevent out of bounds

pull/10106/head
Steven Powell 2021-01-25 09:32:48 -07:00
parent 14bcd9ddec
commit 09d41de3a6
1 changed files with 4 additions and 0 deletions

View File

@ -64,6 +64,10 @@ func Log(startTime time.Time) {
func shouldLog() bool {
// commands that should not be logged.
no := []string{"status", "version"}
// in rare chance we get here without a command, don't log
if len(os.Args) < 2 {
return false
}
a := os.Args[1]
for _, c := range no {
if a == c {