From 6a1013888f1fc2fa8abf60678a334495dc443fd4 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 2 Apr 2018 14:30:58 -0600 Subject: [PATCH] sanity check on buffer read --- wolfcrypt/src/asn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index e7b647bec..12efc1987 100755 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -11075,6 +11075,9 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key, if (GetMyVersion(input, inOutIdx, &version, inSz) < 0) return ASN_PARSE_E; + if (*inOutIdx >= inSz) + return ASN_PARSE_E; + b = input[*inOutIdx]; *inOutIdx += 1;