From e31b15875b77d811cbe5e5a87721d5b269b4b7c7 Mon Sep 17 00:00:00 2001 From: Brett Nicholas <7547222+bigbrett@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:25:18 -0700 Subject: [PATCH] fix buffer overflow due to uninitialized idx variable --- tests/api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/api.c b/tests/api.c index a2363c382..5b8efa7cf 100644 --- a/tests/api.c +++ b/tests/api.c @@ -35001,8 +35001,10 @@ static int test_wc_dilithium_der(void) WC_NO_ERR_TRACE(BAD_FUNC_ARG)); /* When security level is not set, we attempt to parse it from DER. Since * the supplied DER is invalid, this should fail with ASN parsing error */ + idx = 0; ExpectIntEQ(wc_Dilithium_PublicKeyDecode(der, &idx, key, pubDerLen), WC_NO_ERR_TRACE(ASN_PARSE_E)); + idx = 0; ExpectIntEQ(wc_Dilithium_PrivateKeyDecode(der, &idx, key, privDerLen), WC_NO_ERR_TRACE(ASN_PARSE_E));