Skip to content

Commit

Permalink
add nil check on block before parsing certs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitris committed Oct 17, 2024
1 parent e74e44e commit 98d2028
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/cosign/cli/trustedroot/trustedroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func parseCerts(path string) ([]*x509.Certificate, error) {
return nil, err
}

for block, contents := pem.Decode(contents); ; block, contents = pem.Decode(contents) {
for block, contents := pem.Decode(contents); block != nil; block, contents = pem.Decode(contents) {
cert, err := x509.ParseCertificate(block.Bytes)
if err != nil {
return nil, err
Expand Down

0 comments on commit 98d2028

Please sign in to comment.