From 09d41de3a6f1e28894ec2582b527e3bea4e4d56b Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Mon, 25 Jan 2021 09:32:48 -0700 Subject: [PATCH] added arg length check to prevent out of bounds --- pkg/minikube/audit/audit.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/minikube/audit/audit.go b/pkg/minikube/audit/audit.go index 83afccd671..8e2a498ac7 100644 --- a/pkg/minikube/audit/audit.go +++ b/pkg/minikube/audit/audit.go @@ -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 {