fix: a crash in KMS cert reload function (#16158)

This commit is contained in:
Harshavardhana
2022-12-02 11:19:05 -08:00
committed by GitHub
parent 98cffbce03
commit 9b35c72349

View File

@@ -102,12 +102,12 @@ func NewWithConfig(config Config) (KMS, error) {
if !ok {
return
}
sameCert := true
sameCert := len(certificate.Certificate) == len(prevCertificate.Certificate)
for i, b := range certificate.Certificate {
if !bytes.Equal(b, prevCertificate.Certificate[i]) {
sameCert = false
if !sameCert {
break
}
sameCert = sameCert && bytes.Equal(b, prevCertificate.Certificate[i])
}
// Do not reload if its the same cert as before.
if !sameCert {