prevent out of range when check issuer exist

This commit is contained in:
dalun
2023-09-13 00:32:48 +00:00
parent a692ec818d
commit c6c523e005
2 changed files with 5 additions and 14 deletions

View File

@@ -53,6 +53,11 @@ func ExtractIssuerName(certBytes []byte) (string, error) {
return "", fmt.Errorf("failed to parse certificate: %v", err)
}
// Check if exist incase some acme server didn't have org section
if len(cert.Issuer.Organization) == 0 {
return "", fmt.Errorf("cert didn't have org section exist")
}
// Extract the issuer name
issuer := cert.Issuer.Organization[0]