diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 582654aed..01e30541f 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -16030,14 +16030,17 @@ static int ParseCRL_Extensions(DecodedCRL* dcrl, const byte* buf, idx = *inOutIdx; + /* CRL Extensions are optional */ if ((idx + 1) > sz) - return BUFFER_E; + return 0; + /* CRL Extensions are optional */ if (GetASNTag(buf, &idx, &tag, sz) < 0) - return ASN_PARSE_E; + return 0; + /* CRL Extensions are optional */ if (tag != (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 0)) - return ASN_PARSE_E; + return 0; if (GetLength(buf, &idx, &length, sz) < 0) return ASN_PARSE_E; @@ -16130,8 +16133,8 @@ int ParseCRL(DecodedCRL* dcrl, const byte* buff, word32 sz, void* cm) if (ParseCRL_CertList(dcrl, buff, &idx, idx + len) < 0) return ASN_PARSE_E; - /* CRL Extensions optional, ignoring errors */ - ParseCRL_Extensions(dcrl, buff, &idx, idx + len); + if (ParseCRL_Extensions(dcrl, buff, &idx, idx + len) < 0) + return ASN_PARSE_E; idx = dcrl->sigIndex;