MdeModulePkg: Validate the return value before use it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17494 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong 2015-05-22 05:37:44 +00:00 committed by ydong10
parent b965bd99c5
commit cbbc454b2a
1 changed files with 2 additions and 0 deletions

View File

@ -2031,6 +2031,7 @@ ExtractConfigRequest (
}
RequestElement = ConstructRequestElement(Name, Offset, Width);
ConfigHdr = ConstructConfigHdr(Storage, DatabaseRecord->DriverHandle);
ASSERT (ConfigHdr != NULL);
Length = (StrLen (ConfigHdr) + 1 + StrLen(RequestElement) + 1) * sizeof (CHAR16);
*ConfigRequest = AllocatePool (Length);
@ -2138,6 +2139,7 @@ ExtractConfigResp (
RequestElement = ConstructRequestElement(Name, Offset, Width);
ConfigHdr = ConstructConfigHdr(Storage, DatabaseRecord->DriverHandle);
ASSERT (ConfigHdr != NULL);
Length = (StrLen (ConfigHdr) + 1 + StrLen(RequestElement) + 1 + StrLen (L"VALUE=") + StrLen(ValueElement) + 1) * sizeof (CHAR16);
*ConfigResp = AllocatePool (Length);