Fix some potential buffer overflow issue.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8629 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2009-06-23 09:36:17 +00:00
parent 71b320c703
commit 582c23689f
1 changed files with 6 additions and 4 deletions

View File

@ -459,8 +459,8 @@ UpdateConsolePage (
UpdatePageStart (CallbackData);
ASSERT (ConsoleMenu->MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (CallbackData->BmmFakeNvData.ConsoleCheck[0])));
for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {
for (Index = 0; ((Index < ConsoleMenu->MenuNumber) && \
(Index < (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (UINT8)))) ; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
CheckFlags = 0;
@ -484,7 +484,8 @@ UpdateConsolePage (
);
}
for (Index2 = 0; Index2 < TerminalMenu.MenuNumber; Index2++) {
for (Index2 = 0; ((Index2 < TerminalMenu.MenuNumber) && \
(Index2 < (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (UINT8)))); Index2++) {
CheckFlags = 0;
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index2);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
@ -548,7 +549,8 @@ UpdateOrderPage (
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL);
for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
for (Index = 0; ((Index < OptionMenu->MenuNumber) && \
(Index < (sizeof (CallbackData->BmmFakeNvData.OptionOrder) / sizeof (UINT8))))); Index++) {
NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,