summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao, Jiewen <jiewen.yao@intel.com>2015-09-02 08:32:00 +0000
committerhwu1225 <hwu1225@Edk2>2015-09-02 08:32:00 +0000
commit353938e942b2ac12332012f93e353b21900d0ecf (patch)
treeb7074c68beb0dc967ae888f0e01a078f6b401dee
parent81ae98cc176cb6c8be13f7f776663fd99d9ad60a (diff)
downloadedk2-platforms-353938e942b2ac12332012f93e353b21900d0ecf.tar.xz
Add more strict check for MOR variable, besides MOR lock variable.
(Sync patch r18383 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com> Reviewed-by: "Zhang, Chao B" <chao.b.zhang@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18386 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLock.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLock.c b/SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLock.c
index 7ca707915e..c6f3edc756 100644
--- a/SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLock.c
+++ b/SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLock.c
@@ -144,19 +144,20 @@ SetVariableCheckHandlerMor (
}
//
+ // Delete not OK
+ //
+ if ((DataSize != sizeof(UINT8)) || (Data == NULL) || (Attributes == 0)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
// check format
//
if (IsMorLockVariable(VariableName, VendorGuid)) {
//
- // Delete not OK
- //
- if ((DataSize == 0) || (Data == NULL) || (Attributes == 0)) {
- return EFI_INVALID_PARAMETER;
- }
- //
// set to any other value not OK
//
- if ((DataSize != sizeof(UINT8)) || ((*(UINT8 *)Data != 1) && (*(UINT8 *)Data != 0))) {
+ if ((*(UINT8 *)Data != 1) && (*(UINT8 *)Data != 0)) {
return EFI_INVALID_PARAMETER;
}
}