mirror of https://github.com/acidanthera/audk.git
MdePkg/UnitTestBaseLib: Add check for pointer BinData
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2531 AllocatePool may fail and BinData may be invalid, check it before use. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
This commit is contained in:
parent
695d90b9b1
commit
090e267b5b
|
@ -252,9 +252,11 @@ RfcDecodeTest(
|
||||||
BinSize = AsciiStrnLenS (binString, MAX_TEST_STRING_SIZE);
|
BinSize = AsciiStrnLenS (binString, MAX_TEST_STRING_SIZE);
|
||||||
|
|
||||||
BinData = AllocatePool (BinSize);
|
BinData = AllocatePool (BinSize);
|
||||||
Btc->BufferToFree = BinData;
|
UT_ASSERT_NOT_NULL(BinData);
|
||||||
|
|
||||||
|
Btc->BufferToFree = BinData;
|
||||||
ReturnSize = BinSize;
|
ReturnSize = BinSize;
|
||||||
|
|
||||||
Status = Base64Decode (b64String, b64StringLen, BinData, &ReturnSize);
|
Status = Base64Decode (b64String, b64StringLen, BinData, &ReturnSize);
|
||||||
|
|
||||||
UT_ASSERT_STATUS_EQUAL (Status, Btc->ExpectedStatus);
|
UT_ASSERT_STATUS_EQUAL (Status, Btc->ExpectedStatus);
|
||||||
|
|
Loading…
Reference in New Issue