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:
return EFI_BUFFER_TOO_SMALL;\r
}\r
\r
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
\r
return EFI_SUCCESS;\r
}\r
/** @file\r
Helper functions for configuring or getting the parameters relating to iSCSI.\r
\r
/** @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
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
if (EFI_ERROR (Status)) {\r
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid iSCSI Name!", NULL);\r
} else {\r
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
/** @file\r
iSCSI DHCP related configuration routines.\r
\r
/** @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
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
- AsciiStrCpy (ConfigNvData->TargetName, Field->Str);\r
+ AsciiStrCpyS (ConfigNvData->TargetName, ISCSI_NAME_MAX_SIZE, Field->Str);\r
/** @file\r
The IScsi's EFI_EXT_SCSI_PASS_THRU_PROTOCOL driver.\r
\r
/** @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
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
\r
CopyMem (&Node->Iscsi.Lun, ConfigNvData->BootLun, sizeof (UINT64));\r
Node->Iscsi.TargetPortalGroupTag = Session->TargetPortalGroupTag;\r
\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
\r
*DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;\r
\r
/** @file\r
Miscellaneous routines for iSCSI driver.\r
\r
/** @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
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
for (Index = 0; Index < 4; Index++) {\r
\r
if ((Lun[2 * Index] | Lun[2 * Index + 1]) == 0) {\r
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
} else {\r
TempStr[0] = (CHAR16) IScsiHexString[Lun[2 * Index] >> 4];\r
TempStr[1] = (CHAR16) IScsiHexString[Lun[2 * Index] & 0x0F];\r
/** @file\r
Helper functions for configuring or getting the parameters relating to Ip4.\r
\r
/** @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
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
*Results = AllocateZeroPool (Size * sizeof (CHAR16));\r
ASSERT (*Results != NULL);\r
StrPointer = *Results;\r
*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
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
FreePool (DeviceResult);\r
FreePool (FormResult);\r
} else if (HiiIsConfigHdrMatch (Request, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {\r
/** @file\r
Support routines for Mtftp.\r
\r
/** @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
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
\r
Packet->OpCode = HTONS (Instance->Operation);\r
Cur = Packet->Rrq.Filename;\r
\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 += 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
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
\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
Cur += AsciiStrLen ((CHAR8 *) Options[Index].OptionStr) + 1;\r
+ Len -= (AsciiStrLen ((CHAR8 *) Options[Index].OptionStr) + 1);\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
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
}\r
\r
return Mtftp4SendPacket (Instance, Nbuf);\r
TftpError->OpCode = HTONS (EFI_MTFTP4_OPCODE_ERROR);\r
TftpError->Error.ErrorCode = HTONS (ErrCode);\r
\r
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
\r
return Mtftp4SendPacket (Instance, Packet);\r
}\r
/** @file\r
PxeBc MTFTP functions.\r
\r
/** @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
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
if (Packet->OpCode == EFI_MTFTP4_OPCODE_ERROR) {\r
Private->Mode.TftpErrorReceived = TRUE;\r
Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode;\r
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
Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';\r
}\r
\r
}\r
\r
ReqOpt[0].OptionStr = (UINT8*)mMtftpOptions[PXE_MTFTP_OPTION_TSIZE_INDEX];\r
}\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
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
if (Status == EFI_TFTP_ERROR) {\r
Private->Mode.TftpErrorReceived = TRUE;\r
Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode;\r
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
);\r
Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';\r
}\r
\r
ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
ReqOpt[0].ValueStr = OptBuf;\r
\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
\r
ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
ReqOpt[0].ValueStr = OptBuf;\r
\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
\r
ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];\r
ReqOpt[0].ValueStr = OptBuf;\r
\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
/** @file\r
Mtftp routines for PxeBc.\r
\r
/** @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
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
#define PXE_MTFTP_OPTION_MAXIMUM_INDEX 4\r
\r
#define PXE_MTFTP_ERROR_STRING_LENGTH 127\r
#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
/** @file\r
Support routines for PxeBc.\r
\r
/** @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
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
/**\r
Convert unsigned int number to decimal number.\r
\r
/**\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
@return the length of the number after transform.\r
\r
**/\r
UINTN\r
UtoA10 (\r
IN UINTN Number,\r
+ IN CHAR8 *Buffer,\r
+ IN UINTN BufferSize\r
Number = Number / 10;\r
} while (Number != 0);\r
\r
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
\r
return AsciiStrLen (Buffer);\r
}\r
/** @file\r
Support routines for PxeBc.\r
/** @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
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
/**\r
Convert unsigned int number to decimal number.\r
\r
/**\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
@return the length of the number after transform.\r
\r
**/\r
UINTN\r
UtoA10 (\r
IN UINTN Number,\r
+ IN CHAR8 *Buffer,\r
+ IN UINTN BufferSize\r
+ \r
/** @file\r
HII Config Access protocol implementation of VLAN configuration module.\r
\r
/** @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
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
for (Index = 0; Index < NumberOfVlan; Index++) {\r
String = VlanStr;\r
\r
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
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
- 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
String += 11;\r
String += UnicodeValueToString (String, 0, VlanData[Index].Priority, 4);\r
*String = 0;\r
}\r
PrivateData->MacString = MacString;\r
\r
}\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
HiiSetString (\r
HiiHandle,\r
STRING_TOKEN (STR_VLAN_FORM_SET_TITLE_HELP),\r