]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
BaseTools:Change the path of the file that Binary Cache
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.c
index fd8555e30e8619efdc66a13e30095fc9f70fafef..24d844cbf16fd48f8c7bf647d51e71a6015b395c 100644 (file)
@@ -1,15 +1,8 @@
 /** @file\r
   HII Config Access protocol implementation of VLAN configuration module.\r
 \r
-Copyright (c) 2009 - 2014, 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
-text of the license may be found at<BR>\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -327,7 +320,7 @@ VlanCallback (
       break;\r
     }\r
   }\r
-  \r
+\r
   HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);\r
   FreePool (Configuration);\r
   return EFI_SUCCESS;\r
@@ -412,19 +405,27 @@ 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
+    UnicodeValueToStringS (VlanIdStr, sizeof (VlanIdStr), 0, VlanData[Index].VlanId, 5);\r
+    DigitalCount = StrnLenS (VlanIdStr, ARRAY_SIZE (VlanIdStr));\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
+    UnicodeValueToStringS (\r
+      String,\r
+      sizeof (VlanStr) - ((UINTN)String - (UINTN)VlanStr),\r
+      0,\r
+      VlanData[Index].Priority,\r
+      4\r
+      );\r
+    String += StrnLenS (String, ARRAY_SIZE (VlanStr) - ((UINTN)String - (UINTN)VlanStr) / sizeof (CHAR16));\r
     *String = 0;\r
 \r
     StringId = HiiSetString (PrivateData->HiiHandle, 0, VlanStr, NULL);\r
@@ -559,9 +560,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
@@ -599,7 +600,7 @@ UninstallVlanConfigForm (
 {\r
   EFI_STATUS                   Status;\r
   EFI_VLAN_CONFIG_PROTOCOL     *VlanConfig;\r
-  \r
+\r
   //\r
   // End the parent-child relationship.\r
   //\r