Skip to content

Commit 7dbf2a0

Browse files
authored
Merge pull request #7865 from bandi13/fixMemOverrunInTest
Fix possible memory overrun in tests
2 parents 3875a18 + ab7bc29 commit 7dbf2a0

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

.github/workflows/curl.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ jobs:
5858
with:
5959
name: wolf-install-curl
6060

61-
- name: untar build-dir
62-
run: tar -xf build-dir.tgz
61+
- name: untar build-dir
62+
run: tar -xf build-dir.tgz
6363

6464
- name: Build curl
6565
uses: wolfSSL/actions-build-autotools-project@v1

wolfcrypt/test/test.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18501,11 +18501,13 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t certext_test(void)
1850118501
return WC_TEST_RET_ENC_EC(ret);
1850218502

1850318503
/* check the SKID from a RSA certificate */
18504-
if (XMEMCMP(skid_rsa, cert.extSubjKeyId, sizeof(cert.extSubjKeyId)))
18504+
if ((sizeof(skid_rsa) - 1 != cert.extSubjKeyIdSz) ||
18505+
(XMEMCMP(skid_rsa, cert.extSubjKeyId, cert.extSubjKeyIdSz)))
1850518506
return WC_TEST_RET_ENC_NC;
1850618507

1850718508
/* check the AKID from an RSA certificate */
18508-
if (XMEMCMP(akid_rsa, cert.extAuthKeyId, sizeof(cert.extAuthKeyId)))
18509+
if ((sizeof(akid_rsa) - 1 != cert.extAuthKeyIdSz) ||
18510+
(XMEMCMP(akid_rsa, cert.extAuthKeyId, cert.extAuthKeyIdSz)))
1850918511
return WC_TEST_RET_ENC_NC;
1851018512

1851118513
/* check the Key Usage from an RSA certificate */
@@ -18552,7 +18554,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t certext_test(void)
1855218554
/* check the SKID from a ECC certificate - generated dynamically */
1855318555

1855418556
/* check the AKID from an ECC certificate */
18555-
if (XMEMCMP(akid_ecc, cert.extAuthKeyId, sizeof(cert.extAuthKeyId)))
18557+
if ((sizeof(akid_ecc) - 1 != cert.extAuthKeyIdSz) ||
18558+
(XMEMCMP(akid_ecc, cert.extAuthKeyId, cert.extAuthKeyIdSz)))
1855618559
return WC_TEST_RET_ENC_NC;
1855718560

1855818561
/* check the Key Usage from an ECC certificate */
@@ -18600,11 +18603,13 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t certext_test(void)
1860018603
return WC_TEST_RET_ENC_EC(ret);
1860118604

1860218605
/* check the SKID from a CA certificate */
18603-
if (XMEMCMP(kid_ca, cert.extSubjKeyId, sizeof(cert.extSubjKeyId)))
18606+
if ((sizeof(kid_ca) - 1 != cert.extSubjKeyIdSz) ||
18607+
(XMEMCMP(kid_ca, cert.extSubjKeyId, cert.extSubjKeyIdSz)))
1860418608
return WC_TEST_RET_ENC_NC;
1860518609

1860618610
/* check the AKID from an CA certificate */
18607-
if (XMEMCMP(kid_ca, cert.extAuthKeyId, sizeof(cert.extAuthKeyId)))
18611+
if ((sizeof(kid_ca) - 1 != cert.extAuthKeyIdSz) ||
18612+
(XMEMCMP(kid_ca, cert.extAuthKeyId, cert.extAuthKeyIdSz)))
1860818613
return WC_TEST_RET_ENC_NC;
1860918614

1861018615
/* check the Key Usage from CA certificate */

0 commit comments

Comments
 (0)