diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index fe1635a70..de59cdeca 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -179,7 +179,11 @@ WOLFSSL_LOCAL int GetLength_ex(const byte* input, word32* inOutIdx, int* len, } b = input[idx++]; - if (b >= ASN_LONG_LENGTH) { + if (b == ASN_LONG_LENGTH) { + WOLFSSL_MSG("GetLength bad length length"); + return ASN_PARSE_E; + } + else if (b > ASN_LONG_LENGTH) { word32 bytes = b & 0x7F; if ((idx + bytes) > maxIdx) { /* for reading bytes */