mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-06 15:10:51 +02:00
add guard to clear null dereference
This commit is contained in:
+16
-14
@@ -23967,21 +23967,23 @@ static int test_ParseSerial0FixtureMatrix(void)
|
||||
ExpectIntGE(derSz = wc_CertPemToDer(pemBuf, (int)pemSz, derBuf,
|
||||
(int)pemSz, CERT_TYPE), 0);
|
||||
|
||||
wc_InitDecodedCert(&dc, derBuf, (word32)derSz, NULL);
|
||||
ret = wc_ParseCert(&dc, CERT_TYPE, NO_VERIFY, NULL);
|
||||
if (cases[i].certTypeShouldPass)
|
||||
ExpectIntEQ(ret, 0);
|
||||
else
|
||||
ExpectIntNE(ret, 0);
|
||||
wc_FreeDecodedCert(&dc);
|
||||
if (EXPECT_SUCCESS()) {
|
||||
wc_InitDecodedCert(&dc, derBuf, (word32)derSz, NULL);
|
||||
ret = wc_ParseCert(&dc, CERT_TYPE, NO_VERIFY, NULL);
|
||||
if (cases[i].certTypeShouldPass)
|
||||
ExpectIntEQ(ret, 0);
|
||||
else
|
||||
ExpectIntNE(ret, 0);
|
||||
wc_FreeDecodedCert(&dc);
|
||||
|
||||
wc_InitDecodedCert(&dc, derBuf, (word32)derSz, NULL);
|
||||
ret = wc_ParseCert(&dc, CA_TYPE, NO_VERIFY, NULL);
|
||||
if (cases[i].caTypeShouldPass)
|
||||
ExpectIntEQ(ret, 0);
|
||||
else
|
||||
ExpectIntNE(ret, 0);
|
||||
wc_FreeDecodedCert(&dc);
|
||||
wc_InitDecodedCert(&dc, derBuf, (word32)derSz, NULL);
|
||||
ret = wc_ParseCert(&dc, CA_TYPE, NO_VERIFY, NULL);
|
||||
if (cases[i].caTypeShouldPass)
|
||||
ExpectIntEQ(ret, 0);
|
||||
else
|
||||
ExpectIntNE(ret, 0);
|
||||
wc_FreeDecodedCert(&dc);
|
||||
}
|
||||
|
||||
XFREE(derBuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(pemBuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
Reference in New Issue
Block a user