From e7b0fefd7ae03468a91c5765b120820d7a7f3f47 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 1 Mar 2018 09:28:08 -0700 Subject: [PATCH] add sanity check on read index --- wolfcrypt/src/asn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index f9c8589d1..d71db8707 100755 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -3482,6 +3482,9 @@ int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key, return ASN_PARSE_E; /* Option NULL ASN.1 tag */ + if (*inOutIdx >= inSz) { + return BUFFER_E; + } if (input[*inOutIdx] == ASN_TAG_NULL) { ret = GetASNNull(input, inOutIdx, inSz); if (ret != 0)