]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkModulePkg GenericBdsLib: Use safe string functions
authorHao Wu <hao.a.wu@intel.com>
Tue, 30 Jun 2015 06:25:54 +0000 (06:25 +0000)
committerhwu1225 <hwu1225@Edk2>
Tue, 30 Jun 2015 06:25:54 +0000 (06:25 +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@17733 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c

index dbb132226f1374108b9c7e92f986758309727c10..b5be63140f4f8023dab011a47cab8488c0bc8429 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Misc BDS library function\r
 \r
-Copyright (c) 2004 - 2014, 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
@@ -1127,12 +1127,16 @@ SetupResetReminder (
   if (IsResetReminderFeatureEnable ()) {\r
     if (IsResetRequired ()) {\r
 \r
-      StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+      StringBuffer1 = AllocateCopyPool (\r
+                        MAX_STRING_LEN * sizeof (CHAR16),\r
+                        L"Configuration changed. Reset to apply it Now."\r
+                        );\r
       ASSERT (StringBuffer1 != NULL);\r
-      StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+      StringBuffer2 = AllocateCopyPool (\r
+                        MAX_STRING_LEN * sizeof (CHAR16),\r
+                        L"Press ENTER to reset"\r
+                        );\r
       ASSERT (StringBuffer2 != NULL);\r
-      StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now.");\r
-      StrCpy (StringBuffer2, L"Press ENTER to reset");\r
       //\r
       // Popup a menu to notice user\r
       //\r
index 047d2a7dbcd9c8557ba91cb904b4953ff33c30ba..000542bdceb83397aa97cc046bc61d3522bb4eb4 100644 (file)
@@ -3,7 +3,7 @@
   performance, all the function will only include if the performance\r
   switch is set.\r
 \r
-Copyright (c) 2004 - 2013, 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
@@ -40,7 +40,7 @@ GetShortPdbFileName (
   UINTN EndIndex;\r
 \r
   if (PdbFileName == NULL) {\r
-    AsciiStrCpy (GaugeString, " ");\r
+    AsciiStrCpyS (GaugeString, PERF_TOKEN_LENGTH, " ");\r
   } else {\r
     StartIndex = 0;\r
     for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)\r
@@ -91,7 +91,7 @@ GetNameFromHandle (
   CHAR8                       *PdbFileName;\r
   EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;\r
 \r
-  AsciiStrCpy (GaugeString, " ");\r
+  AsciiStrCpyS (GaugeString, PERF_TOKEN_LENGTH, " ");\r
 \r
   //\r
   // Get handle name from image protocol\r
@@ -287,7 +287,7 @@ WriteBootToOsPerformanceData (
 \r
       GetNameFromHandle (Handles[Index], GaugeString);\r
 \r
-      AsciiStrCpy (mPerfData.Token, GaugeString);\r
+      AsciiStrCpyS (mPerfData.Token, PERF_TOKEN_SIZE, GaugeString);\r
       mPerfData.Duration = Duration;\r
 \r
       CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));\r
@@ -316,7 +316,7 @@ WriteBootToOsPerformanceData (
 \r
       ZeroMem (&mPerfData, sizeof (PERF_DATA));\r
 \r
-      AsciiStrnCpy (mPerfData.Token, Token, PERF_TOKEN_LENGTH);\r
+      AsciiStrnCpyS (mPerfData.Token, PERF_TOKEN_SIZE, Token, PERF_TOKEN_LENGTH);\r
       if (StartTicker == 1) {\r
         StartTicker = StartValue;\r
       }\r