chore: Appease gosec linter (#5777)

These happen to be harmless memory aliasing
but I guess the linter can't know that and we
can't really prove it in general.
This commit is contained in:
Matt Holt 2023-08-23 20:47:54 -06:00 committed by GitHub
parent 4776f62caa
commit b377208ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -529,7 +529,8 @@ func (t TLSConfig) MakeTLSClientConfig(ctx caddy.Context) (*tls.Config, error) {
certs := caddytls.AllMatchingCertificates(t.ClientCertificateAutomate) certs := caddytls.AllMatchingCertificates(t.ClientCertificateAutomate)
var err error var err error
for _, cert := range certs { for _, cert := range certs {
err = cri.SupportsCertificate(&cert.Certificate) certCertificate := cert.Certificate // avoid taking address of iteration variable (gosec warning)
err = cri.SupportsCertificate(&certCertificate)
if err == nil { if err == nil {
return &cert.Certificate, nil return &cert.Certificate, nil
} }

View File

@ -58,7 +58,8 @@ nextChoice:
if len(p.SerialNumber) > 0 { if len(p.SerialNumber) > 0 {
var found bool var found bool
for _, sn := range p.SerialNumber { for _, sn := range p.SerialNumber {
if cert.Leaf.SerialNumber.Cmp(&sn.Int) == 0 { snInt := sn.Int // avoid taking address of iteration variable (gosec warning)
if cert.Leaf.SerialNumber.Cmp(&snInt) == 0 {
found = true found = true
break break
} }