From c468b4e2a897e1c21e30c32736e7f487c29d83ca Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Thu, 30 Mar 2023 23:03:48 +0800 Subject: [PATCH] fix: avoid out of slice index (#16925) --- cmd/http-tracer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/http-tracer.go b/cmd/http-tracer.go index 20c953977..7e57576c8 100644 --- a/cmd/http-tracer.go +++ b/cmd/http-tracer.go @@ -39,7 +39,7 @@ var ldapPwdRegex = regexp.MustCompile("(^.*?)LDAPPassword=([^&]*?)(&(.*?))?$") // redact LDAP password if part of string func redactLDAPPwd(s string) string { parts := ldapPwdRegex.FindStringSubmatch(s) - if len(parts) > 0 { + if len(parts) > 3 { return parts[1] + "LDAPPassword=*REDACTED*" + parts[3] } return s