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
/** @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
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
/** @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
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
/** @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
\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
/** @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
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
/** @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
*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
/** @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
\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
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
/** @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
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
}\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
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
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
\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
\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
/** @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
#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
/** @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
/**\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
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
/** @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
/**\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
/** @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
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
}\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