fix: avoid out of slice index (#16925)

This commit is contained in:
jiuker authored and GitHub committed 2023-03-30 08:03:48 -07:00
1 parent b04956a676
commit c468b4e2a8
1 file changed
+1 -1
+1 -1
View File
@@ -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