Merge pull request #7106 from bandi13/20231114-codesonar-fixes

20231114 codesonar fixes
pull/7111/head
Sean Parkinson 2024-01-04 07:16:33 +10:00 committed by GitHub
commit 52db533d9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 3 deletions

View File

@ -186,6 +186,7 @@ int BuildTlsFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
return MEMORY_E;
#endif
XMEMSET(handshake_hash, 0, HSHASH_SZ);
ret = BuildTlsHandshakeHash(ssl, handshake_hash, &hashSz);
if (ret == 0) {
if (XSTRNCMP((const char*)sender, (const char*)kTlsClientStr,

View File

@ -11173,7 +11173,7 @@ err:
pemSz = (int)(l - i);
/* check calculated length */
if (pemSz > MAX_WOLFSSL_FILE_SIZE || pemSz < 0) {
if (pemSz > MAX_WOLFSSL_FILE_SIZE || pemSz <= 0) {
WOLFSSL_MSG("PEM_read_X509_ex file size error");
return NULL;
}

View File

@ -10350,6 +10350,9 @@ exit_enc:
RESET_MULTI_VALUE_STATS_VARS();
if (ret != 0)
goto exit;
bench_stats_start(&count, &start);
do {
for (i = 0; i < ntimes; i++) {

View File

@ -37602,8 +37602,10 @@ int wc_MIME_parse_headers(char* in, int inLen, MimeHdr** headers)
mimeType == MIME_PARAM)) && pos >= 1) {
mimeStatus = MIME_BODYVAL;
end = pos-1;
if (nameAttr != NULL)
if (nameAttr != NULL) {
XFREE(nameAttr, NULL, DYNAMIC_TYPE_PKCS7);
nameAttr = NULL;
}
ret = wc_MIME_header_strip(curLine, &nameAttr, start, end);
if (ret) {
goto error;

View File

@ -12576,7 +12576,14 @@ int wc_PKCS7_EncodeEncryptedData(PKCS7* pkcs7, byte* output, word32 outputSz)
return MEMORY_E;
}
FlattenAttributes(pkcs7, flatAttribs, attribs, attribsCount);
ret = FlattenAttributes(pkcs7, flatAttribs, attribs, attribsCount);
if (ret != 0) {
XFREE(attribs, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
XFREE(plain, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
XFREE(flatAttribs, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
return ret;
}
attribsSetSz = SetImplicit(ASN_SET, 1, attribsSz, attribSet);
} else {