Skip to content

Commit

Permalink
Merge pull request #7865 from bandi13/fixMemOverrunInTest
Browse files Browse the repository at this point in the history
Fix possible memory overrun in tests
  • Loading branch information
douzzer authored Aug 13, 2024
2 parents 3875a18 + ab7bc29 commit 7dbf2a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/curl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
with:
name: wolf-install-curl

- name: untar build-dir
run: tar -xf build-dir.tgz
- name: untar build-dir
run: tar -xf build-dir.tgz

- name: Build curl
uses: wolfSSL/actions-build-autotools-project@v1
Expand Down
15 changes: 10 additions & 5 deletions wolfcrypt/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -18501,11 +18501,13 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t certext_test(void)
return WC_TEST_RET_ENC_EC(ret);

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

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

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

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

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

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

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

/* check the Key Usage from CA certificate */
Expand Down

0 comments on commit 7dbf2a0

Please sign in to comment.