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

IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c

index 85cbe8951d5234801abec757a8279bcd03f5f065..5da0d470a32dc6f7b8814a9ca8d07047721a697b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The platform device manager reference implementation\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
@@ -374,13 +374,12 @@ GetMacAddressString(
   // The size is the Number size + ":" size + Vlan size(\XXXX) + End\r
   //\r
   BufferLen = (4 + 2 * HwAddressSize + (HwAddressSize - 1) + 5 + 1) * sizeof (CHAR16);\r
-  String = AllocateZeroPool (BufferLen);\r
+  String = AllocateCopyPool (BufferLen, L"MAC:");\r
   if (String == NULL) {\r
     return FALSE;\r
   }\r
 \r
   *PBuffer = String;\r
-  StrCpy(String, L"MAC:");\r
   String += 4;\r
   \r
   //\r
@@ -1383,15 +1382,15 @@ CallDriverHealth (
        String = (EFI_STRING) AllocateZeroPool (StringSize);\r
        ASSERT (String != NULL);\r
        \r
-       StrnCpy (String, DriverName, StringSize / sizeof(CHAR16));\r
+       StrCpyS (String, StringSize / sizeof(CHAR16), DriverName);\r
        if (!IsControllerNameEmpty) {\r
-        StrnCat (String, L"    ", StringSize / sizeof(CHAR16) - StrLen(String) - 1);\r
-        StrnCat (String, ControllerName, StringSize / sizeof(CHAR16) - StrLen(String) - 1);\r
+        StrCatS (String, StringSize / sizeof(CHAR16), L"    ");\r
+        StrCatS (String, StringSize / sizeof(CHAR16), ControllerName);\r
        }\r
 \r
-       StrnCat (String, L"    ", StringSize / sizeof(CHAR16) - StrLen(String) - 1);\r
-       StrnCat (String, TmpString, StringSize / sizeof(CHAR16) - StrLen(String) - 1);\r
-       \r
+       StrCatS (String, StringSize / sizeof(CHAR16), L"    ");\r
+       StrCatS (String, StringSize / sizeof(CHAR16), TmpString);\r
+\r
     } else {\r
       //\r
       // Update the string will be displayed base on the driver's health status\r
@@ -1423,13 +1422,13 @@ CallDriverHealth (
       String = (EFI_STRING) AllocateZeroPool (StringSize);\r
       ASSERT (String != NULL);\r
       \r
-      StrnCpy (String, DriverName, StringSize / sizeof(CHAR16));\r
+      StrCpyS (String, StringSize / sizeof (CHAR16), DriverName);\r
       if (!IsControllerNameEmpty) {\r
-        StrnCat (String, L"    ", StringSize / sizeof(CHAR16) - StrLen(String) - 1);\r
-        StrnCat (String, ControllerName, StringSize / sizeof(CHAR16) - StrLen(String) - 1);\r
+        StrCatS (String, StringSize / sizeof (CHAR16), L"    ");\r
+        StrCatS (String, StringSize / sizeof (CHAR16), ControllerName);\r
       }\r
 \r
-      StrnCat (String, TmpString, StringSize / sizeof(CHAR16) - StrLen(String) - 1);\r
+      StrCatS (String, StringSize / sizeof (CHAR16), TmpString);\r
     }\r
 \r
     FreePool (TmpString);\r