mirror of https://github.com/golang/go.git
crypto/x509: remove letters from the end of basic constraints parsing errors
Change-Id: I84533d2df1a20f6337c43b1ca00d8022909a0018
GitHub-Last-Rev: 7dcc4e7296
GitHub-Pull-Request: golang/go#59195
Reviewed-on: https://go-review.googlesource.com/c/go/+/478816
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
42f99b203d
commit
33b634803b
|
|
@ -334,17 +334,17 @@ func parseKeyUsageExtension(der cryptobyte.String) (KeyUsage, error) {
|
|||
func parseBasicConstraintsExtension(der cryptobyte.String) (bool, int, error) {
|
||||
var isCA bool
|
||||
if !der.ReadASN1(&der, cryptobyte_asn1.SEQUENCE) {
|
||||
return false, 0, errors.New("x509: invalid basic constraints a")
|
||||
return false, 0, errors.New("x509: invalid basic constraints")
|
||||
}
|
||||
if der.PeekASN1Tag(cryptobyte_asn1.BOOLEAN) {
|
||||
if !der.ReadASN1Boolean(&isCA) {
|
||||
return false, 0, errors.New("x509: invalid basic constraints b")
|
||||
return false, 0, errors.New("x509: invalid basic constraints")
|
||||
}
|
||||
}
|
||||
maxPathLen := -1
|
||||
if !der.Empty() && der.PeekASN1Tag(cryptobyte_asn1.INTEGER) {
|
||||
if !der.ReadASN1Integer(&maxPathLen) {
|
||||
return false, 0, errors.New("x509: invalid basic constraints c")
|
||||
return false, 0, errors.New("x509: invalid basic constraints")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue