tests/api.c: fix error path uninited-data defects in test_wc_PKCS7_EncodeSignedData() (followup to bf95f80c6d, detected by valgrind).

This commit is contained in:
Daniel Pouzzner
2025-04-11 09:20:14 -05:00
parent 1fb8f5f0c4
commit cfd93b1bd4

View File

@ -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);