]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
MdeModulePkg: Replace [Ascii|Unicode]ValueToString
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.c
index 5e0fe42a883a1c8e2c741ff97af72dbb5f737903..f0357062186657aa498e0142fd57fbc810e7a767 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HII Config Access protocol implementation of VLAN configuration module.\r
 \r
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2017, 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
@@ -417,14 +417,22 @@ VlanUpdateForm (
     //\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
     StrCpyS (String + 4 - DigitalCount, (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount), VlanIdStr);\r
     String += 4;\r
 \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