Skip to content

Commit cd8d158

Browse files
authored
Merge pull request #8073 from philljj/fix_infer_issues
infer: fix dead store, and uninitialized value errors.
2 parents c714664 + f507477 commit cd8d158

5 files changed

Lines changed: 17 additions & 13 deletions

File tree

src/ssl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20419,7 +20419,6 @@ WOLFSSL_CTX* wolfSSL_set_SSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
2041920419
}
2042020420

2042120421
ssl->buffers.weOwnCert = 1;
20422-
ret = WOLFSSL_SUCCESS;
2042320422
}
2042420423
if (ctx->certChain != NULL) {
2042520424
if (ssl->buffers.certChain != NULL) {
@@ -20435,7 +20434,6 @@ WOLFSSL_CTX* wolfSSL_set_SSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
2043520434
}
2043620435

2043720436
ssl->buffers.weOwnCertChain = 1;
20438-
ret = WOLFSSL_SUCCESS;
2043920437
}
2044020438
#else
2044120439
/* ctx owns certificate, certChain and key */

src/tls13.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8568,6 +8568,8 @@ static int SendTls13Certificate(WOLFSSL* ssl)
85688568
WOLFSSL_START(WC_FUNC_CERTIFICATE_SEND);
85698569
WOLFSSL_ENTER("SendTls13Certificate");
85708570

8571+
XMEMSET(extSz, 0, sizeof(extSz));
8572+
85718573
ssl->options.buildingMsg = 1;
85728574

85738575
#ifdef WOLFSSL_POST_HANDSHAKE_AUTH

tests/api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5031,7 +5031,7 @@ static int test_wolfSSL_CTX_use_certificate_chain_buffer_format(void)
50315031
WOLFSSL* ssl = NULL;
50325032
const char* cert = "./certs/server-cert.pem";
50335033
unsigned char* buf = NULL;
5034-
size_t len;
5034+
size_t len = 0;
50355035

50365036
ExpectIntEQ(load_file(cert, &buf, &len), 0);
50375037

@@ -21014,7 +21014,7 @@ static int test_RsaDecryptBoundsCheck(void)
2101421014
WC_RNG rng;
2101521015
RsaKey key;
2101621016
byte flatC[256];
21017-
word32 flatCSz;
21017+
word32 flatCSz = 0;
2101821018
byte out[256];
2101921019
word32 outSz = sizeof(out);
2102021020

@@ -23432,7 +23432,7 @@ static int test_wc_DsaSignVerify(void)
2343223432
byte hash[WC_SHA_DIGEST_SIZE];
2343323433
word32 idx = 0;
2343423434
word32 bytes;
23435-
int answer;
23435+
int answer = 0;
2343623436
#ifdef USE_CERT_BUFFERS_1024
2343723437
byte tmp[ONEK_BUF];
2343823438

@@ -25778,7 +25778,7 @@ static int test_wc_ecc_params(void)
2577825778
#if !defined(NO_ECC256) && !defined(NO_ECC_SECP)
2577925779
/* Test for SECP256R1 curve */
2578025780
int curve_id = ECC_SECP256R1;
25781-
int curve_idx;
25781+
int curve_idx = 0;
2578225782

2578325783
ExpectIntNE(curve_idx = wc_ecc_get_curve_idx(curve_id), ECC_CURVE_INVALID);
2578425784
ExpectNotNull(ecc_set = wc_ecc_get_curve_params(curve_idx));

wolfcrypt/src/asn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25402,9 +25402,9 @@ int PemToDer(const unsigned char* buff, long longSz, int type,
2540225402
{
2540325403
const char* header = NULL;
2540425404
const char* footer = NULL;
25405-
const char* headerEnd;
25406-
const char* footerEnd;
25407-
const char* consumedEnd;
25405+
const char* headerEnd = NULL;
25406+
const char* footerEnd = NULL;
25407+
const char* consumedEnd = NULL;
2540825408
const char* bufferEnd = (const char*)(buff + longSz);
2540925409
long neededSz;
2541025410
int ret = 0;

wolfcrypt/test/test.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15005,8 +15005,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesgcm_test(void)
1500515005
byte resultC[sizeof(p) + AES_BLOCK_SIZE];
1500615006
wc_test_ret_t ret = 0;
1500715007

15008-
int alen;
15009-
int plen;
15008+
int alen = 0;
15009+
int plen = 0;
1501015010
#if defined(WOLFSSL_XILINX_CRYPT_VERSAL)
1501115011
byte buf[sizeof(p) + AES_BLOCK_SIZE];
1501215012
byte bufA[sizeof(a) + 1];
@@ -21482,7 +21482,7 @@ static wc_test_ret_t rsa_oaep_padding_test(RsaKey* key, WC_RNG* rng)
2148221482
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void)
2148321483
{
2148421484
wc_test_ret_t ret;
21485-
size_t bytes;
21485+
size_t bytes = 0;
2148621486
WC_RNG rng;
2148721487
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
2148821488
byte* tmp = NULL;
@@ -22781,7 +22781,11 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t dh_test(void)
2278122781
{
2278222782
wc_test_ret_t ret;
2278322783
word32 bytes;
22784-
word32 idx = 0, privSz, pubSz, privSz2, pubSz2;
22784+
word32 idx = 0;
22785+
word32 privSz = 0;
22786+
word32 pubSz = 0;
22787+
word32 privSz2 = 0;
22788+
word32 pubSz2 = 0;
2278522789
#ifndef WC_NO_RNG
2278622790
WC_RNG rng;
2278722791
int rngInit = 0;

0 commit comments

Comments
 (0)