]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkModulePkg BootMngr: Use safe string functions
authorHao Wu <hao.a.wu@intel.com>
Tue, 30 Jun 2015 06:27:44 +0000 (06:27 +0000)
committerhwu1225 <hwu1225@Edk2>
Tue, 30 Jun 2015 06:27:44 +0000 (06:27 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17737 6f19259b-4bc3-4df7-8a09-765794883524

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