Skip to content

Commit dae7d89

Browse files
committed
return error early when parsing certificate to prevent go from panic
1 parent 14ec4d9 commit dae7d89

File tree

2 files changed

+5
-176
lines changed

2 files changed

+5
-176
lines changed

client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,11 @@ func (c *Client) addChallengePassword(csr []byte, challengePassword string) ([]b
499499
return csr, nil
500500
}
501501

502-
stdCsr, _ := x509.ParseCertificateRequest(csr)
502+
stdCsr, err := x509.ParseCertificateRequest(csr)
503+
if err != nil {
504+
return nil, err
505+
}
506+
503507
cr := x509util.CertificateRequest{
504508
CertificateRequest: *stdCsr,
505509
ChallengePassword: challengePassword,

0 commit comments

Comments
 (0)