Merge pull request #7394 from mprse/fix_pkcs7_test_alloc

Fix memory allocations in pkcs7_verify test
This commit is contained in:
Dave Rodgman 2023-04-04 15:46:59 +01:00 committed by GitHub
commit 56f59d749c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,8 +84,8 @@ void pkcs7_verify(char *pkcs7_file,
} }
} }
ASSERT_ALLOC(crts, sizeof(*crts)*n_crts); ASSERT_ALLOC(crts, n_crts);
ASSERT_ALLOC(crt_files_arr, sizeof(*crt_files_arr)*n_crts); ASSERT_ALLOC(crt_files_arr, n_crts);
for (i = 0; i < strlen(crt_files); i++) { for (i = 0; i < strlen(crt_files); i++) {
for (k = i; k < strlen(crt_files); k++) { for (k = i; k < strlen(crt_files); k++) {
@ -101,7 +101,7 @@ void pkcs7_verify(char *pkcs7_file,
mbedtls_pkcs7_init(&pkcs7); mbedtls_pkcs7_init(&pkcs7);
for (i = 0; i < n_crts; i++) { for (i = 0; i < n_crts; i++) {
ASSERT_ALLOC(crts[i], sizeof(*crts[i])); ASSERT_ALLOC(crts[i], 1);
mbedtls_x509_crt_init(crts[i]); mbedtls_x509_crt_init(crts[i]);
} }