forked from wolfSSL/wolfssl
fixes for defects:
clang-analyzer-deadcode.DeadStores in examples/server/server.c; -Werror=use-after-free and LeakSanitizer Direct leak in tests/api.c; nullPointerRedundantCheck in src/pk.c which identified a semantically consequential flub.
This commit is contained in:
@ -578,7 +578,9 @@ static void ServerRead(WOLFSSL* ssl, char* input, int inputLen)
|
|||||||
else if (SSL_get_error(ssl, 0) == 0 &&
|
else if (SSL_get_error(ssl, 0) == 0 &&
|
||||||
tcp_select(SSL_get_fd(ssl), 0) == TEST_RECV_READY) {
|
tcp_select(SSL_get_fd(ssl), 0) == TEST_RECV_READY) {
|
||||||
/* do a peek and check for "pending" */
|
/* do a peek and check for "pending" */
|
||||||
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||||
err = 0;
|
err = 0;
|
||||||
|
#endif
|
||||||
do {
|
do {
|
||||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||||
if (err == WC_PENDING_E) {
|
if (err == WC_PENDING_E) {
|
||||||
|
2
src/pk.c
2
src/pk.c
@ -3112,7 +3112,7 @@ WC_RNG* WOLFSSL_RSA_GetRNG(WOLFSSL_RSA* rsa, WC_RNG** tmpRng, int* initTmpRng)
|
|||||||
if ((!err) && (rng == NULL) && (tmpRng != NULL)) {
|
if ((!err) && (rng == NULL) && (tmpRng != NULL)) {
|
||||||
/* Make an RNG with tmpRng or get global. */
|
/* Make an RNG with tmpRng or get global. */
|
||||||
rng = wolfssl_make_rng(*tmpRng, initTmpRng);
|
rng = wolfssl_make_rng(*tmpRng, initTmpRng);
|
||||||
if ((rng != NULL) && initTmpRng) {
|
if ((rng != NULL) && *initTmpRng) {
|
||||||
*tmpRng = rng;
|
*tmpRng = rng;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43525,6 +43525,9 @@ static int test_wolfSSL_PEM_read_DHparams(void)
|
|||||||
AssertIntEQ(derOutSz, derExpectedSz);
|
AssertIntEQ(derOutSz, derExpectedSz);
|
||||||
AssertIntEQ(XMEMCMP(derOut, derExpected, derOutSz), 0);
|
AssertIntEQ(XMEMCMP(derOut, derExpected, derOutSz), 0);
|
||||||
|
|
||||||
|
DH_free(dh);
|
||||||
|
dh = NULL;
|
||||||
|
|
||||||
/* Test parsing with X9.42 header */
|
/* Test parsing with X9.42 header */
|
||||||
fp = XFOPEN("./certs/x942dh2048.pem", "rb");
|
fp = XFOPEN("./certs/x942dh2048.pem", "rb");
|
||||||
AssertNotNull(dh = PEM_read_DHparams(fp, &dh, NULL, NULL));
|
AssertNotNull(dh = PEM_read_DHparams(fp, &dh, NULL, NULL));
|
||||||
@ -56139,11 +56142,11 @@ static int test_wolfSSL_PEM_write_DHparams(void)
|
|||||||
AssertNotNull(fp = XFOPEN("./test-write-dhparams.pem", "wb"));
|
AssertNotNull(fp = XFOPEN("./test-write-dhparams.pem", "wb"));
|
||||||
AssertIntEQ(PEM_write_DHparams(fp, dh), WOLFSSL_SUCCESS);
|
AssertIntEQ(PEM_write_DHparams(fp, dh), WOLFSSL_SUCCESS);
|
||||||
AssertIntEQ(PEM_write_DHparams(fp, NULL), WOLFSSL_FAILURE);
|
AssertIntEQ(PEM_write_DHparams(fp, NULL), WOLFSSL_FAILURE);
|
||||||
XFCLOSE(fp);
|
|
||||||
DH_free(dh);
|
DH_free(dh);
|
||||||
|
|
||||||
dh = wolfSSL_DH_new();
|
dh = wolfSSL_DH_new();
|
||||||
AssertIntEQ(PEM_write_DHparams(fp, dh), WOLFSSL_FAILURE);
|
AssertIntEQ(PEM_write_DHparams(fp, dh), WOLFSSL_FAILURE);
|
||||||
|
XFCLOSE(fp);
|
||||||
wolfSSL_DH_free(dh);
|
wolfSSL_DH_free(dh);
|
||||||
|
|
||||||
/* check results */
|
/* check results */
|
||||||
|
Reference in New Issue
Block a user