From 0e280c4f296fe65e26bdde392d1c400b127c43b9 Mon Sep 17 00:00:00 2001 From: Mark Atwood Date: Fri, 7 Aug 2026 13:33:26 -0700 Subject: [PATCH] fix(tests): avoid unsigned underflow in DH group loop --- tests/api/test_dh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/api/test_dh.c b/tests/api/test_dh.c index d79c168305c..a6a430132f5 100644 --- a/tests/api/test_dh.c +++ b/tests/api/test_dh.c @@ -566,7 +566,7 @@ int test_wc_DhGenerateKeyPair_and_Agree(void) ExpectIntEQ(wc_InitRng(&rng), 0); - for (i = 0; i < sizeof(groups) / sizeof(groups[0]) - 1; i++) { + for (i = 0; i + 1 < sizeof(groups) / sizeof(groups[0]); i++) { XMEMSET(&aliceKey, 0, sizeof(aliceKey)); XMEMSET(&bobKey, 0, sizeof(bobKey)); ExpectIntEQ(wc_InitDhKey(&aliceKey), 0);