]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Replace unsafe string functions.
authorZhang Lubo <lubo.zhang@intel.com>
Wed, 8 Jul 2015 06:35:37 +0000 (06:35 +0000)
committerluobozhang <luobozhang@Edk2>
Wed, 8 Jul 2015 06:35:37 +0000 (06:35 +0000)
Replace unsafe string functions with new added safe string functions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17881 6f19259b-4bc3-4df7-8a09-765794883524

12 files changed:
MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c
MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c
MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcMtftp.c
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcMtftp.h
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h
MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c

index 2a2bac127921da46642555dfc290d2669aec34ac..ce26b322bcb2cf619e705ae1e66af847fa019930 100644 (file)
@@ -3230,7 +3230,7 @@ NetLibIp6ToStr (
     return EFI_BUFFER_TOO_SMALL;\r
   }\r
 \r
-  StrCpy (String, Buffer);\r
+  StrCpyS (String, StringSize / sizeof (CHAR16), Buffer);\r
 \r
   return EFI_SUCCESS;\r
 }\r
index e263f0e306b68134970ca5caf6c6cdc139245d86..7b77fd386bde53bb241711d3b807b129d86c2f60 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Helper functions for configuring or getting the parameters relating to iSCSI.\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
@@ -778,7 +778,7 @@ IScsiFormCallback (
       if (EFI_ERROR (Status)) {\r
         CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid iSCSI Name!", NULL);\r
       } else {\r
-        AsciiStrCpy (Private->Current->SessionConfigData.TargetName, IScsiName);\r
+        AsciiStrCpyS (Private->Current->SessionConfigData.TargetName, ISCSI_NAME_MAX_SIZE, IScsiName);\r
       }\r
 \r
       break;\r
index 79e70934e6c83d726b3732204149bbbd82ab210a..d574ce21dda0206a6f54d0c599d1812bf5ce04f8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   iSCSI DHCP related configuration routines.\r
 \r
-Copyright (c) 2004 - 2010, 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
@@ -158,7 +158,7 @@ IScsiDhcpExtractRootPath (
     goto ON_EXIT;\r
   }\r
 \r
-  AsciiStrCpy (ConfigNvData->TargetName, Field->Str);\r
+  AsciiStrCpyS (ConfigNvData->TargetName, ISCSI_NAME_MAX_SIZE, Field->Str);\r
 \r
 ON_EXIT:\r
 \r
index da141055427eb1b8519110f85664214fee5aa3d7..e9e37b7e37e7b6aacf1a7ea5e9d67375b17b2706 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The IScsi's EFI_EXT_SCSI_PASS_THRU_PROTOCOL driver.\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
@@ -244,7 +244,7 @@ IScsiExtScsiPassThruBuildDevicePath (
 \r
   CopyMem (&Node->Iscsi.Lun, ConfigNvData->BootLun, sizeof (UINT64));\r
   Node->Iscsi.TargetPortalGroupTag = Session->TargetPortalGroupTag;\r
-  AsciiStrCpy ((CHAR8 *) Node + sizeof (ISCSI_DEVICE_PATH), ConfigNvData->TargetName);\r
+  AsciiStrCpyS ((CHAR8 *) Node + sizeof (ISCSI_DEVICE_PATH), AsciiStrLen (ConfigNvData->TargetName) + 1, ConfigNvData->TargetName);\r
 \r
   *DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;\r
 \r
index 1cb1fb89d9ec97c44160a8f6f28ddb3f189537be..61c407e6fff780d21dc2b23791635a6e20f3892e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Miscellaneous routines for iSCSI driver.\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
@@ -204,7 +204,7 @@ IScsiLunToUnicodeStr (
   for (Index = 0; Index < 4; Index++) {\r
 \r
     if ((Lun[2 * Index] | Lun[2 * Index + 1]) == 0) {\r
-      StrCpy (TempStr, L"0-");\r
+      CopyMem(TempStr, L"0-", sizeof (L"0-"));\r
     } else {\r
       TempStr[0]  = (CHAR16) IScsiHexString[Lun[2 * Index] >> 4];\r
       TempStr[1]  = (CHAR16) IScsiHexString[Lun[2 * Index] & 0x0F];\r
index 89e1ddaf39063cb49df33f03993f80291bab6667..794bb799490219248da952202e11f3709d69f250 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Helper functions for configuring or getting the parameters relating to Ip4.\r
 \r
-Copyright (c) 2009 - 2012, 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 of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -487,10 +487,10 @@ Ip4DeviceExtractConfig (
     *Results = AllocateZeroPool (Size * sizeof (CHAR16));\r
     ASSERT (*Results != NULL);\r
     StrPointer  = *Results;\r
-    StrCpy (StrPointer, DeviceResult);\r
+    StrCpyS (StrPointer, Size, DeviceResult);\r
     StrPointer  = StrPointer + StrLen (StrPointer);\r
     *StrPointer = L'&';\r
-    StrCpy (StrPointer + 1, FormResult);\r
+    StrCpyS (StrPointer + 1, StrLen (FormResult) + 1, FormResult);\r
     FreePool (DeviceResult);\r
     FreePool (FormResult);\r
   } else if (HiiIsConfigHdrMatch (Request, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {\r
index df79c85fa00a5c9888b3966b9f89c3729b5f8f8b..cfb4b26df2e538d2459aa6476c320606f4d9c560 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support routines for Mtftp.\r
   \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -319,17 +319,20 @@ Mtftp4SendRequest (
 \r
   Packet->OpCode = HTONS (Instance->Operation);\r
   Cur            = Packet->Rrq.Filename;\r
-  Cur            = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Token->Filename);\r
+  Cur            = (UINT8 *) AsciiStrCpyS ((CHAR8 *) Cur, Len - 2, (CHAR8 *) Token->Filename);\r
   Cur           += AsciiStrLen ((CHAR8 *) Token->Filename) + 1;\r
-  Cur            = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Mode);\r
+  Cur            = (UINT8 *) AsciiStrCpyS ((CHAR8 *) Cur, Len - 2 - (AsciiStrLen ((CHAR8 *) Token->Filename) + 1), (CHAR8 *) Mode);\r
   Cur           += AsciiStrLen ((CHAR8 *) Mode) + 1;\r
+  Len -= ((UINT32) AsciiStrLen ((CHAR8 *) Token->Filename) + (UINT32) AsciiStrLen ((CHAR8 *) Mode) + 4);\r
 \r
   for (Index = 0; Index < Token->OptionCount; ++Index) {\r
-    Cur  = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].OptionStr);\r
+    Cur  = (UINT8 *) AsciiStrCpyS ((CHAR8 *) Cur, Len, (CHAR8 *) Options[Index].OptionStr);\r
     Cur += AsciiStrLen ((CHAR8 *) Options[Index].OptionStr) + 1;\r
+    Len -= (AsciiStrLen ((CHAR8 *) Options[Index].OptionStr) + 1);\r
 \r
-    Cur  = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].ValueStr);\r
+    Cur  = (UINT8 *) AsciiStrCpyS ((CHAR8 *) Cur, Len, (CHAR8 *) Options[Index].ValueStr);\r
     Cur += AsciiStrLen ((CHAR8 *) (CHAR8 *) Options[Index].ValueStr) + 1;\r
+    Len -= (AsciiStrLen ((CHAR8 *) (CHAR8 *) Options[Index].ValueStr) + 1);\r
   }\r
 \r
   return Mtftp4SendPacket (Instance, Nbuf);\r
@@ -371,7 +374,7 @@ Mtftp4SendError (
   TftpError->OpCode = HTONS (EFI_MTFTP4_OPCODE_ERROR);\r
   TftpError->Error.ErrorCode = HTONS (ErrCode);\r
 \r
-  AsciiStrCpy ((CHAR8 *) TftpError->Error.ErrorMessage, (CHAR8 *) ErrInfo);\r
+  AsciiStrCpyS ((CHAR8 *) TftpError->Error.ErrorMessage, Len, (CHAR8 *) ErrInfo);\r
 \r
   return Mtftp4SendPacket (Instance, Packet);\r
 }\r
index aa73132cb59d6237d72ad4872d802322fcc8e192..8017b73dd7ba618e39d36ed858f154a1464188f6 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   PxeBc MTFTP functions.\r
   \r
-Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 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
@@ -60,7 +60,7 @@ PxeBcCheckPacket (
   if (Packet->OpCode == EFI_MTFTP4_OPCODE_ERROR) {\r
     Private->Mode.TftpErrorReceived = TRUE;\r
     Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode;\r
-    AsciiStrnCpy (Private->Mode.TftpError.ErrorString, (CHAR8 *) Packet->Error.ErrorMessage, PXE_MTFTP_ERROR_STRING_LENGTH);\r
+    AsciiStrnCpyS (Private->Mode.TftpError.ErrorString, PXE_MTFTP_ERROR_STRING_LENGTH, (CHAR8 *) Packet->Error.ErrorMessage, PXE_MTFTP_ERROR_STRING_LENGTH - 1);\r
     Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';\r
   }\r
 \r
@@ -135,13 +135,13 @@ PxeBcTftpGetFileSize (
   }\r
 \r
   ReqOpt[0].OptionStr = (UINT8*)mMtftpOptions[PXE_MTFTP_OPTION_TSIZE_INDEX];\r
-  UtoA10 (0, (CHAR8 *) OptBuf);\r
+  UtoA10 (0, (CHAR8 *) OptBuf, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);\r
   ReqOpt[0].ValueStr = OptBuf;\r
 \r
   if (BlockSize != NULL) {\r
     ReqOpt[1].OptionStr = (UINT8*)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
     ReqOpt[1].ValueStr  = ReqOpt[0].ValueStr + AsciiStrLen ((CHAR8 *) ReqOpt[0].ValueStr) + 1;\r
-    UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[1].ValueStr);\r
+    UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[1].ValueStr, PXE_MTFTP_OPTBUF_MAXNUM_INDEX - (AsciiStrLen ((CHAR8 *) ReqOpt[0].ValueStr) + 1));\r
     OptCnt++;\r
   }\r
 \r
@@ -160,10 +160,11 @@ PxeBcTftpGetFileSize (
     if (Status == EFI_TFTP_ERROR) {\r
       Private->Mode.TftpErrorReceived = TRUE;\r
       Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode;\r
-      AsciiStrnCpy (\r
-        Private->Mode.TftpError.ErrorString, \r
-        (CHAR8 *) Packet->Error.ErrorMessage, \r
-        PXE_MTFTP_ERROR_STRING_LENGTH\r
+      AsciiStrnCpyS (\r
+        Private->Mode.TftpError.ErrorString,\r
+        PXE_MTFTP_ERROR_STRING_LENGTH,\r
+        (CHAR8 *) Packet->Error.ErrorMessage,\r
+        PXE_MTFTP_ERROR_STRING_LENGTH - 1\r
         );\r
       Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';\r
     }\r
@@ -261,7 +262,7 @@ PxeBcTftpReadFile (
 \r
     ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
     ReqOpt[0].ValueStr  = OptBuf;\r
-    UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr);\r
+    UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);\r
     OptCnt++;\r
   }\r
 \r
@@ -344,7 +345,7 @@ PxeBcTftpWriteFile (
 \r
     ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
     ReqOpt[0].ValueStr  = OptBuf;\r
-    UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr);\r
+    UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);\r
     OptCnt++;\r
   }\r
 \r
@@ -418,7 +419,7 @@ PxeBcTftpReadDirectory (
 \r
     ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
     ReqOpt[0].ValueStr  = OptBuf;\r
-    UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr);\r
+    UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);\r
     OptCnt++;\r
   }\r
 \r
index 9920aff8b01a1c0cdb74eef03feb1704df29e53d..241b079d721c728f6059d5dfa51ed4a8e2b21666 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Mtftp routines for PxeBc.\r
     \r
-Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 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
@@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define PXE_MTFTP_OPTION_MAXIMUM_INDEX   4\r
 \r
 #define PXE_MTFTP_ERROR_STRING_LENGTH    127\r
+#define PXE_MTFTP_OPTBUF_MAXNUM_INDEX    128\r
 \r
 \r
 /**\r
index 327e4a26d81cad633d30d7aa502d4a4e4ea6ea52..3016da73241134e16903823dd52cd8e6a7c47dd3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support routines for PxeBc.\r
 \r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 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
@@ -140,16 +140,18 @@ CvtNum (
 /**\r
   Convert unsigned int number to decimal number.\r
 \r
-  @param  Number   The unsigned int number will be converted.\r
-  @param  Buffer   Pointer to the buffer to store the decimal number after transform.\r
-\r
+  @param      Number         The unsigned int number will be converted.\r
+  @param      Buffer         Pointer to the buffer to store the decimal number after transform.\r
+  @param[in]  BufferSize     The maxsize of the buffer.\r
+  \r
   @return the length of the number after transform.\r
 \r
 **/\r
 UINTN\r
 UtoA10 (\r
   IN UINTN Number,\r
-  IN CHAR8 *Buffer\r
+  IN CHAR8 *Buffer,\r
+  IN UINTN BufferSize\r
   )\r
 {\r
   UINTN Index;\r
@@ -164,7 +166,7 @@ UtoA10 (
     Number          = Number / 10;\r
   } while (Number != 0);\r
 \r
-  AsciiStrCpy (Buffer, &TempStr[Index]);\r
+  AsciiStrCpyS (Buffer, BufferSize, &TempStr[Index]);\r
 \r
   return AsciiStrLen (Buffer);\r
 }\r
index 96f48f56de3ede0d6778ad3110271a578c442663..6f41aa671d21a6e0c32793cdb024d1bd20488766 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
   Support routines for PxeBc.\r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 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
@@ -82,16 +82,19 @@ CvtNum (
 /**\r
   Convert unsigned int number to decimal number.\r
 \r
-  @param  Number   The unsigned int number will be converted.\r
-  @param  Buffer   Pointer to the buffer to store the decimal number after transform.\r
-\r
+  @param      Number         The unsigned int number will be converted.\r
+  @param      Buffer         Pointer to the buffer to store the decimal number after transform.\r
+  @param[in]  BufferSize     The maxsize of the buffer.\r
+  \r
   @return the length of the number after transform.\r
 \r
 **/\r
 UINTN\r
 UtoA10 (\r
   IN UINTN Number,\r
-  IN CHAR8 *Buffer\r
+  IN CHAR8 *Buffer,\r
+  IN UINTN BufferSize\r
+  \r
   );\r
 \r
 \r
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