diff options
author | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-29 06:33:23 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-29 06:33:23 +0000 |
commit | 04eb20aa85f658b86dd8b6b4fc261d2c9ff2e6a3 (patch) | |
tree | 5c99c188718cfc42810f70ad1f7f6fe0d216e37c /MdeModulePkg/Universal/Variable | |
parent | 57ad9d43b16aada77eaf6f6e1aaa0dd94f032bf2 (diff) | |
download | edk2-platforms-04eb20aa85f658b86dd8b6b4fc261d2c9ff2e6a3.tar.xz |
Add pointer check for NULL before dereference it.
Signed-off-by: ydong10
Reviewed-by: rsun3, lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12472 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Variable')
-rw-r--r-- | MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c index d36254cc67..df42eda670 100644 --- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c +++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c @@ -1177,6 +1177,7 @@ EmuGetVariable ( VARIABLE_POINTER_TRACK Variable;
UINTN VarDataSize;
EFI_STATUS Status;
+ UINT8 *VariableDataPtr;
if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1201,8 +1202,10 @@ EmuGetVariable ( Status = EFI_INVALID_PARAMETER;
goto Done;
}
-
- CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr), VarDataSize);
+ VariableDataPtr = GetVariableDataPtr (Variable.CurrPtr);
+ ASSERT (VariableDataPtr != NULL);
+
+ CopyMem (Data, VariableDataPtr, VarDataSize);
if (Attributes != NULL) {
*Attributes = Variable.CurrPtr->Attributes;
}
|