From cfd93b1bd42934a01c8594035ee58b2037b13825 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Fri, 11 Apr 2025 09:20:14 -0500 Subject: [PATCH] tests/api.c: fix error path uninited-data defects in test_wc_PKCS7_EncodeSignedData() (followup to bf95f80c6d, detected by valgrind). --- tests/api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/api.c b/tests/api.c index 2df73577e..fcfb98e14 100644 --- a/tests/api.c +++ b/tests/api.c @@ -15772,11 +15772,13 @@ static int test_wc_PKCS7_EncodeSignedData(void) { int signedSz = 0, i; encodeSignedDataStream strm; - int numberOfChunkSizes = 4; - word32 chunkSizes[] = { 4080, 4096, 5000, 9999 }; + static const int numberOfChunkSizes = 4; + static const word32 chunkSizes[] = { 4080, 4096, 5000, 9999 }; /* chunkSizes were chosen to test around the default 4096 octet string * size used in pkcs7.c */ + XMEMSET(&strm, 0, sizeof(strm)); + ExpectNotNull(pkcs7 = wc_PKCS7_New(HEAP_HINT, testDevId)); ExpectIntEQ(wc_PKCS7_Init(pkcs7, HEAP_HINT, INVALID_DEVID), 0);