diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 9d2e7f66b..e98816582 100755 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -2014,7 +2014,7 @@ WOLFSSL_LOCAL int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid, return ASN_OBJECT_ID_E; /* could have NULL tag and 0 terminator, but may not */ - if (input[idx] == ASN_TAG_NULL) { + if (idx < maxIdx && input[idx] == ASN_TAG_NULL) { ret = GetASNNull(input, &idx, maxIdx); if (ret != 0) return ret;