Skip to content

Commit b7332e3

Browse files
committed
Tests api.c: fixes
NULL dereference. Uninitialized variable use.
1 parent 18032cd commit b7332e3

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

tests/api.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45985,16 +45985,18 @@ static int test_wolfSSL_sk_GENERAL_NAME(void)
4598545985
for (i = 0; i < sk_GENERAL_NAME_num(sk); i++) {
4598645986
ExpectNotNull(gn = sk_GENERAL_NAME_value(sk, i));
4598745987

45988-
switch (gn->type) {
45989-
case GEN_DNS:
45990-
fprintf(stderr, "found type GEN_DNS\n");
45991-
break;
45992-
case GEN_EMAIL:
45993-
fprintf(stderr, "found type GEN_EMAIL\n");
45994-
break;
45995-
case GEN_URI:
45996-
fprintf(stderr, "found type GEN_URI\n");
45997-
break;
45988+
if (gn != NULL) {
45989+
switch (gn->type) {
45990+
case GEN_DNS:
45991+
fprintf(stderr, "found type GEN_DNS\n");
45992+
break;
45993+
case GEN_EMAIL:
45994+
fprintf(stderr, "found type GEN_EMAIL\n");
45995+
break;
45996+
case GEN_URI:
45997+
fprintf(stderr, "found type GEN_URI\n");
45998+
break;
45999+
}
4599846000
}
4599946001
}
4600046002
X509_free(x509);
@@ -46840,7 +46842,8 @@ static int test_wolfSSL_EVP_Cipher_extra(void)
4684046842

4684146843
byte inb[BUFFSZ];
4684246844
byte outb[BUFFSZ+16];
46843-
int outl, inl;
46845+
int outl = 0;
46846+
int inl;
4684446847

4684546848
iv = aes128_cbc_iv;
4684646849
ivlen = sizeof(aes128_cbc_iv);
@@ -55715,7 +55718,7 @@ static int test_wolfssl_EVP_aes_gcm_AAD_2_parts(void)
5571555718
byte out2Part[16];
5571655719
byte outTag2Part[16];
5571755720
byte decryptBuf[16];
55718-
int len;
55721+
int len = 0;
5571955722
int tlen;
5572055723
EVP_CIPHER_CTX* ctx = NULL;
5572155724

@@ -59463,7 +59466,7 @@ static int test_wolfSSL_EC_POINT(void)
5946359466
#ifndef HAVE_SELFTEST
5946459467
EC_POINT *tmp = NULL;
5946559468
size_t bin_len;
59466-
unsigned int blen;
59469+
unsigned int blen = 0;
5946759470
unsigned char* buf = NULL;
5946859471
unsigned char bufInf[1] = { 0x00 };
5946959472

0 commit comments

Comments
 (0)