]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
1. fix AtaPassThru.PassThru() sct failure
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMaint / UpdatePage.c
index 6e5d61c4c4d5a161c84df4cef0c5749aec298045..137a622c90847f62f98271fd0fc7c775b1e84a68 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
 Dynamically update the pages.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -180,7 +180,7 @@ BootThisFile (
 \r
   Option = (BDS_COMMON_OPTION *) AllocatePool (sizeof (BDS_COMMON_OPTION));\r
   ASSERT (Option != NULL);\r
-  Option->Description     = FileContext->FileName;\r
+  Option->Description     = (CHAR16 *) AllocateCopyPool (StrSize (FileContext->FileName), FileContext->FileName);\r
   Option->DevicePath      = FileContext->DevicePath;\r
   Option->LoadOptionsSize = 0;\r
   Option->LoadOptions     = NULL;\r
@@ -490,6 +490,7 @@ UpdateConsolePage (
     NewMenuEntry        = BOpt_GetMenuEntry (&TerminalMenu, Index2);\r
     NewTerminalContext  = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
 \r
+    ASSERT (Index < MAX_MENU_NUMBER);\r
     if (((NewTerminalContext->IsConIn != 0) && (UpdatePageId == FORM_CON_IN_ID)) ||\r
         ((NewTerminalContext->IsConOut != 0) && (UpdatePageId == FORM_CON_OUT_ID)) ||\r
         ((NewTerminalContext->IsStdErr != 0) && (UpdatePageId == FORM_CON_ERR_ID))\r
@@ -549,8 +550,19 @@ UpdateOrderPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();\r
   ASSERT (OptionsOpCodeHandle != NULL);\r
   \r
-  for (Index = 0; ((Index < OptionMenu->MenuNumber) && \\r
-       (Index < (sizeof (CallbackData->BmmFakeNvData.OptionOrder) / sizeof (UINT8))))); Index++) {\r
+  for (\r
+        Index = 0;\r
+        (\r
+          (Index < OptionMenu->MenuNumber) &&\r
+          (Index <\r
+            (\r
+              sizeof (CallbackData->BmmFakeNvData.OptionOrder) /\r
+              sizeof (UINT8)\r
+            )\r
+          )\r
+        );\r
+        Index++\r
+      ) {\r
     NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);\r
     HiiCreateOneOfOptionOpCode (\r
       OptionsOpCodeHandle,\r
@@ -742,9 +754,8 @@ UpdateConModePage (
   UINTN                         Index;\r
   UINTN                         Col;\r
   UINTN                         Row;\r
-  CHAR16                        RowString[50];\r
   CHAR16                        ModeString[50];\r
-  UINTN                         TempStringLen;\r
+  CHAR16                        *PStr;\r
   UINTN                         MaxMode;\r
   UINTN                         ValidMode;\r
   EFI_STRING_ID                 *ModeToken;\r
@@ -799,12 +810,11 @@ UpdateConModePage (
     //\r
     // Build mode string Column x Row\r
     //\r
-    TempStringLen = UnicodeValueToString (ModeString, 0, Col, 0);\r
-    ASSERT ((TempStringLen + StrLen (L" x ")) < (sizeof (ModeString) / sizeof (ModeString[0])));\r
-    StrCat (ModeString, L" x ");\r
-    TempStringLen = UnicodeValueToString (RowString, 0, Row, 0);\r
-    ASSERT ((StrLen (ModeString)  + TempStringLen) < (sizeof (ModeString) / sizeof (ModeString[0])));\r
-    StrCat (ModeString, RowString);\r
+    UnicodeValueToString (ModeString, 0, Col, 0);\r
+    PStr = &ModeString[0];\r
+    StrnCat (PStr, L" x ", StrLen(L" x ") + 1);\r
+    PStr = PStr + StrLen (PStr);\r
+    UnicodeValueToString (PStr , 0, Row, 0);\r
 \r
     ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL);\r
 \r