Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu, Siyuan <siyuan.fu@intel.com>
Reviewed-By: Dong, Eric <eric.dong@intel.com>
Reviewed-by: Wu, Jiaxin <jiaxin.wu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15773
6f19259b-4bc3-4df7-8a09-
765794883524
//\r
Str = (CHAR16 *) AllocateZeroPool (StrSize (String));\r
ASSERT (Str != NULL);\r
//\r
Str = (CHAR16 *) AllocateZeroPool (StrSize (String));\r
ASSERT (Str != NULL);\r
- Str = StrCpy (Str, String);\r
+ Str = StrnCpy (Str, String, StrLen (String));\r
Str = (CHAR16 *) AllocateZeroPool (StrSize (ValueStr));\r
ASSERT (Str != NULL);\r
\r
Str = (CHAR16 *) AllocateZeroPool (StrSize (ValueStr));\r
ASSERT (Str != NULL);\r
\r
- Str = StrCpy (Str, ValueStr);\r
+ Str = StrnCpy (Str, ValueStr, StrLen (ValueStr));\r
Private->IfName = Str;\r
}\r
}\r
Private->IfName = Str;\r
}\r
}\r
Str = (CHAR16 *) AllocateZeroPool (StrSize (ValueStr));\r
ASSERT (Str != NULL);\r
\r
Str = (CHAR16 *) AllocateZeroPool (StrSize (ValueStr));\r
ASSERT (Str != NULL);\r
\r
- Str = StrCpy (Str, ValueStr);\r
+ Str = StrnCpy (Str, ValueStr, StrLen (ValueStr));\r
Private->IfName = Str;\r
}\r
}\r
Private->IfName = Str;\r
}\r
}\r
/** @file\r
UEFI Component Name(2) protocol implementation for Dhcp6 driver.\r
\r
/** @file\r
UEFI Component Name(2) protocol implementation for Dhcp6 driver.\r
\r
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
if (Dhcp6ModeData.Ia == NULL) {\r
UnicodeSPrint (HandleName, sizeof (HandleName), L"DHCPv6 (No configured IA)");\r
} else {\r
if (Dhcp6ModeData.Ia == NULL) {\r
UnicodeSPrint (HandleName, sizeof (HandleName), L"DHCPv6 (No configured IA)");\r
} else {\r
- StrCpy (HandleName, mDhcp6ControllerName[Dhcp6ModeData.Ia->State]);\r
+ StrnCpy (HandleName, mDhcp6ControllerName[Dhcp6ModeData.Ia->State], sizeof (HandleName) / sizeof (CHAR16) - 1);\r
}\r
\r
Status = AddUnicodeString2 (\r
}\r
\r
Status = AddUnicodeString2 (\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
+ StrnCpy (TempStr, L"0-", StrLen (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
// Print the interface type.\r
//\r
if (IfInfo->IfType == Ip6InterfaceTypeEthernet) {\r
// Print the interface type.\r
//\r
if (IfInfo->IfType == Ip6InterfaceTypeEthernet) {\r
- StrCpy (PortString, IP6_ETHERNET);\r
+ StrnCpy (PortString, IP6_ETHERNET, sizeof (PortString) / sizeof (CHAR16) - 1);\r
} else if (IfInfo->IfType == Ip6InterfaceTypeExperimentalEthernet) {\r
} else if (IfInfo->IfType == Ip6InterfaceTypeExperimentalEthernet) {\r
- StrCpy (PortString, IP6_EXPERIMENTAL_ETHERNET);\r
+ StrnCpy (PortString, IP6_EXPERIMENTAL_ETHERNET, sizeof (PortString) / sizeof (CHAR16) - 1);\r
} else {\r
//\r
// Refer to RFC1700, chapter Number Hardware Type.\r
} else {\r
//\r
// Refer to RFC1700, chapter Number Hardware Type.\r
for (Index = 0; Index < IfInfo->HwAddressSize; Index++) {\r
\r
if (IfInfo->HwAddress.Addr[Index] < 0x10) {\r
for (Index = 0; Index < IfInfo->HwAddressSize; Index++) {\r
\r
if (IfInfo->HwAddress.Addr[Index] < 0x10) {\r
- StrCpy (FormatString, L"0%x-");\r
+ StrnCpy (FormatString, L"0%x-", sizeof (FormatString) / sizeof (CHAR16) - 1);\r
- StrCpy (FormatString, L"%x-");\r
+ StrnCpy (FormatString, L"%x-", sizeof (FormatString) / sizeof (CHAR16) - 1);\r
}\r
\r
Number = UnicodeSPrint (\r
}\r
\r
Number = UnicodeSPrint (\r
/** @file\r
The implementation of Payloads Creation.\r
\r
/** @file\r
The implementation of Payloads Creation.\r
\r
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
CopyMem (\r
IkeSaSession->NCookie,\r
\r
CopyMem (\r
IkeSaSession->NCookie,\r
- NotifyPayload + sizeof (IKEV2_NOTIFY),\r
+ (UINT8 *)NotifyPayload + sizeof (IKEV2_NOTIFY),\r