Skip to content

Commit 52db533

Browse files
authored
Merge pull request #7106 from bandi13/20231114-codesonar-fixes
20231114 codesonar fixes
2 parents 100c2ec + e5d8ce9 commit 52db533

5 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/tls.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ int BuildTlsFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
186186
return MEMORY_E;
187187
#endif
188188

189+
XMEMSET(handshake_hash, 0, HSHASH_SZ);
189190
ret = BuildTlsHandshakeHash(ssl, handshake_hash, &hashSz);
190191
if (ret == 0) {
191192
if (XSTRNCMP((const char*)sender, (const char*)kTlsClientStr,

src/x509.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11173,7 +11173,7 @@ int wolfSSL_i2d_X509_NAME(WOLFSSL_X509_NAME* name, unsigned char** out)
1117311173
pemSz = (int)(l - i);
1117411174

1117511175
/* check calculated length */
11176-
if (pemSz > MAX_WOLFSSL_FILE_SIZE || pemSz < 0) {
11176+
if (pemSz > MAX_WOLFSSL_FILE_SIZE || pemSz <= 0) {
1117711177
WOLFSSL_MSG("PEM_read_X509_ex file size error");
1117811178
return NULL;
1117911179
}

wolfcrypt/benchmark/benchmark.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10350,6 +10350,9 @@ void bench_eccEncrypt(int curveId)
1035010350

1035110351
RESET_MULTI_VALUE_STATS_VARS();
1035210352

10353+
if (ret != 0)
10354+
goto exit;
10355+
1035310356
bench_stats_start(&count, &start);
1035410357
do {
1035510358
for (i = 0; i < ntimes; i++) {

wolfcrypt/src/asn.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37602,8 +37602,10 @@ int wc_MIME_parse_headers(char* in, int inLen, MimeHdr** headers)
3760237602
mimeType == MIME_PARAM)) && pos >= 1) {
3760337603
mimeStatus = MIME_BODYVAL;
3760437604
end = pos-1;
37605-
if (nameAttr != NULL)
37605+
if (nameAttr != NULL) {
3760637606
XFREE(nameAttr, NULL, DYNAMIC_TYPE_PKCS7);
37607+
nameAttr = NULL;
37608+
}
3760737609
ret = wc_MIME_header_strip(curLine, &nameAttr, start, end);
3760837610
if (ret) {
3760937611
goto error;

wolfcrypt/src/pkcs7.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12576,7 +12576,14 @@ int wc_PKCS7_EncodeEncryptedData(PKCS7* pkcs7, byte* output, word32 outputSz)
1257612576
return MEMORY_E;
1257712577
}
1257812578

12579-
FlattenAttributes(pkcs7, flatAttribs, attribs, attribsCount);
12579+
ret = FlattenAttributes(pkcs7, flatAttribs, attribs, attribsCount);
12580+
if (ret != 0) {
12581+
XFREE(attribs, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
12582+
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
12583+
XFREE(plain, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
12584+
XFREE(flatAttribs, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
12585+
return ret;
12586+
}
1258012587
attribsSetSz = SetImplicit(ASN_SET, 1, attribsSz, attribSet);
1258112588

1258212589
} else {

0 commit comments

Comments
 (0)