fix: avoid out of slice index (#16925)

This commit is contained in:
jiuker 2023-03-30 23:03:48 +08:00 committed by GitHub
parent b04956a676
commit c468b4e2a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

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