This commit is contained in:
Ilja van Sprundel 2025-06-20 15:37:02 -04:00 committed by GitHub
commit 903e898bdb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -943,7 +943,7 @@ func parseCertificate(der []byte) (*Certificate, error) {
if !tbs.ReadOptionalASN1Integer(&cert.Version, cryptobyte_asn1.Tag(0).Constructed().ContextSpecific(), 0) {
return nil, errors.New("x509: malformed version")
}
if cert.Version < 0 {
if cert.Version < 0 || cert.Version > 3 {
return nil, errors.New("x509: malformed version")
}
// for backwards compat reasons Version is one-indexed,