diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-02-11 07:05:43 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-02-11 07:05:43 +0000 |
commit | 96a5ac5b0dc101faa5a4a7364a68f3c4bc9dfe36 (patch) | |
tree | 894c5a61d9dbde61ac6dbad17efb297858cfe4dc /MdeModulePkg/Universal/Variable | |
parent | 51195fbe8cafe567f217724c9f05cb30fed5e6da (diff) | |
download | edk2-platforms-96a5ac5b0dc101faa5a4a7364a68f3c4bc9dfe36.tar.xz |
Adjust code to fix potential array out-bound issues.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7502 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Variable')
-rw-r--r-- | MdeModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c | 4 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Variable/Pei/Variable.c | 6 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Variable/Pei/VariableWorker.c | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/MdeModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c b/MdeModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c index a5e0e550e3..17f152a0f1 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c +++ b/MdeModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c @@ -49,7 +49,9 @@ VariableIndexTableUpdate ( IN VARIABLE_HEADER *Variable
)
{
- IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);
+ if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME) {
+ IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);
+ }
return;
}
diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c index 471b6a4749..f98d236443 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -443,10 +443,8 @@ FindVariable ( //
// Record Variable in VariableIndex HOB
//
- if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME) {
- VariableIndexTableUpdate (IndexTable, Variable);
- }
-
+ VariableIndexTableUpdate (IndexTable, Variable);
+
if (CompareWithValidVariable (Variable, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/Variable/Pei/VariableWorker.c b/MdeModulePkg/Universal/Variable/Pei/VariableWorker.c index f9c5daa452..a99bfa8c50 100644 --- a/MdeModulePkg/Universal/Variable/Pei/VariableWorker.c +++ b/MdeModulePkg/Universal/Variable/Pei/VariableWorker.c @@ -48,7 +48,9 @@ VariableIndexTableUpdate ( IN VARIABLE_HEADER *Variable
)
{
- IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;
+ if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME) {
+ IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;
+ }
return;
}
|