]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
MdeModulePkg: Replace unsafe string functions.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.c
index fd8555e30e8619efdc66a13e30095fc9f70fafef..5e0fe42a883a1c8e2c741ff97af72dbb5f737903 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HII Config Access protocol implementation of VLAN configuration module.\r
 \r
-Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 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\r
 of the BSD License which accompanies this distribution.  The full\r
@@ -412,17 +412,17 @@ VlanUpdateForm (
   for (Index = 0; Index < NumberOfVlan; Index++) {\r
     String = VlanStr;\r
 \r
-    StrCpy (String, L"  VLAN ID:");\r
+    StrCpyS (String, (sizeof (VlanStr) /sizeof (CHAR16)), L"  VLAN ID:");\r
     String += 10;\r
     //\r
     // Pad VlanId string up to 4 characters with space\r
     //\r
     DigitalCount = UnicodeValueToString (VlanIdStr, 0, VlanData[Index].VlanId, 5);\r
     SetMem16 (String, (4 - DigitalCount) * sizeof (CHAR16), L' ');\r
-    StrCpy (String + 4 - DigitalCount, VlanIdStr);\r
+    StrCpyS (String + 4 - DigitalCount, (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount), VlanIdStr);\r
     String += 4;\r
 \r
-    StrCpy (String, L", Priority:");\r
+    StrCpyS (String,  (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount) - 4, L", Priority:");\r
     String += 11;\r
     String += UnicodeValueToString (String, 0, VlanData[Index].Priority, 4);\r
     *String = 0;\r
@@ -559,9 +559,9 @@ InstallVlanConfigForm (
   }\r
   PrivateData->MacString = MacString;\r
 \r
-  StrCpy (Str, L"VLAN Configuration (MAC:");\r
-  StrnCat (Str, MacString, sizeof (EFI_MAC_ADDRESS) * 2);\r
-  StrCat (Str, L")");\r
+  StrCpyS (Str, sizeof (Str) / sizeof (CHAR16), L"VLAN Configuration (MAC:");\r
+  StrCatS (Str, sizeof (Str) / sizeof (CHAR16), MacString);\r
+  StrCatS (Str, sizeof (Str) / sizeof (CHAR16), L")");\r
   HiiSetString (\r
     HiiHandle,\r
     STRING_TOKEN (STR_VLAN_FORM_SET_TITLE_HELP),\r