summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Variable/EmuRuntimeDxe
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-29 06:33:23 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-29 06:33:23 +0000
commit04eb20aa85f658b86dd8b6b4fc261d2c9ff2e6a3 (patch)
tree5c99c188718cfc42810f70ad1f7f6fe0d216e37c /MdeModulePkg/Universal/Variable/EmuRuntimeDxe
parent57ad9d43b16aada77eaf6f6e1aaa0dd94f032bf2 (diff)
downloadedk2-04eb20aa85f658b86dd8b6b4fc261d2c9ff2e6a3.zip
edk2-04eb20aa85f658b86dd8b6b4fc261d2c9ff2e6a3.tar.gz
edk2-04eb20aa85f658b86dd8b6b4fc261d2c9ff2e6a3.tar.bz2
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/EmuRuntimeDxe')
-rw-r--r--MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
index d36254c..df42eda 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;
}