Merge pull request #8336 from douzzer/20250107-clang-tidy-null-derefs

20250107-clang-tidy-null-derefs
This commit is contained in:
David Garske
2025-01-07 08:07:06 -08:00
committed by GitHub
2 changed files with 15 additions and 8 deletions

View File

@ -4316,6 +4316,11 @@ int TLSX_UseCertificateStatusRequestV2(TLSX** extensions, byte status_type,
CertificateStatusRequestItemV2* last =
(CertificateStatusRequestItemV2*)extension->data;
if (last == NULL) {
XFREE(csr2, heap, DYNAMIC_TYPE_TLSX);
return BAD_FUNC_ARG;
}
for (; last->next; last = last->next);
last->next = csr2;

View File

@ -1144,7 +1144,7 @@ static WARN_UNUSED_RESULT int freeDecCertList(WC_DerCertList** list,
#ifdef ASN_BER_TO_DER
/* append data to encrypted content cache in PKCS12 structure
* return buffer on success, NULL on error */
static byte* PKCS12_ConcatonateContent(WC_PKCS12* pkcs12,byte* mergedData,
static byte* PKCS12_ConcatenateContent(WC_PKCS12* pkcs12,byte* mergedData,
word32* mergedSz, byte* in, word32 inSz)
{
byte* oldContent;
@ -1257,7 +1257,7 @@ static int PKCS12_CoalesceOctetStrings(WC_PKCS12* pkcs12, byte* data,
ret = MEMORY_E;
}
}
mergedData = PKCS12_ConcatonateContent(pkcs12, mergedData,
mergedData = PKCS12_ConcatenateContent(pkcs12, mergedData,
&mergedSz, &data[*idx], (word32)encryptedContentSz);
if (mergedData == NULL) {
ret = MEMORY_E;
@ -1269,6 +1269,7 @@ static int PKCS12_CoalesceOctetStrings(WC_PKCS12* pkcs12, byte* data,
*idx += (word32)encryptedContentSz;
}
if (ret == 0) {
*idx = saveIdx;
*idx += SetLength(mergedSz, &data[*idx]);
@ -1279,6 +1280,7 @@ static int PKCS12_CoalesceOctetStrings(WC_PKCS12* pkcs12, byte* data,
XFREE(mergedData, pkcs12->heap, DYNAMIC_TYPE_PKCS);
}
}
return ret;
}