]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
IntelFrameworkModulePkg BootMngr: Use safe string functions
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMngr / BootManager.c
index dc1364899ea3b0f7187a5814de60ebd51f52849c..978959d6e7b6a35a37cc7369605b57472625b5dc 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The platform boot manager reference implementation\r
 \r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2015, 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
@@ -205,11 +205,11 @@ CallBootManager (
   EFI_STRING_ID               Token;\r
   EFI_INPUT_KEY               Key;\r
   CHAR16                      *HelpString;\r
+  UINTN                       HelpSize;\r
   EFI_STRING_ID               HelpToken;\r
   UINT16                      *TempStr;\r
   EFI_HII_HANDLE              HiiHandle;\r
   EFI_BROWSER_ACTION_REQUEST  ActionRequest;\r
-  UINTN                       TempSize;\r
   VOID                        *StartOpCodeHandle;\r
   VOID                        *EndOpCodeHandle;\r
   EFI_IFR_GUID_LABEL          *StartLabel;\r
@@ -318,11 +318,10 @@ CallBootManager (
     Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);\r
 \r
     TempStr = DevicePathToStr (Option->DevicePath);\r
-    TempSize = StrSize (TempStr);\r
-    HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : "));\r
+    HelpSize = StrSize (TempStr) + StrSize (L"Device Path : ");\r
+    HelpString = AllocateCopyPool (HelpSize, L"Device Path : ");\r
     ASSERT (HelpString != NULL);\r
-    StrCat (HelpString, L"Device Path : ");\r
-    StrCat (HelpString, TempStr);\r
+    StrCatS (HelpString, HelpSize / sizeof (CHAR16), TempStr);\r
 \r
     HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL);\r
 \r