From 284065b0a190584412d78cf77dbd833170b3814a Mon Sep 17 00:00:00 2001 From: Jaben Carsey Date: Fri, 29 Aug 2014 22:01:54 +0000 Subject: [PATCH] This patch replaces StrCpy with StrnCpy or refactors out the usage of StrCpy through some other means. This patch replaces StrCat with StrnCat or refactors out the usage of StrCat through some other means. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey Reviewed-by: Erik Bjorge git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16005 6f19259b-4bc3-4df7-8a09-765794883524 --- .../UefiShellNetwork1CommandsLib/Ifconfig.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c index f837bab454..9a85f917bb 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c @@ -271,16 +271,16 @@ AppendOffsetWidthValue ( OriString = String; - StrCpy (String, L"&OFFSET="); + StrnCpy (String, L"&OFFSET=", 9); String += StrLen (L"&OFFSET="); String += UnicodeSPrint (String, 20, L"%x", Offset); - StrCpy (String,L"&WIDTH="); + StrnCpy (String,L"&WIDTH=", 8); String += StrLen (L"&WIDTH="); String += UnicodeSPrint (String, 20, L"%x", Width); if (Block != NULL) { - StrCpy (String,L"&VALUE="); + StrnCpy (String,L"&VALUE=", 8); String += StrLen (L"&VALUE="); while ((Width--) != 0) { String += UnicodeSPrint (String, 20, L"%x", Block[Width]); @@ -369,7 +369,7 @@ ConstructConfigHdr ( } String = ConfigHdr; - StrCpy (String, L"GUID="); + StrnCpy (String, L"GUID=", 6); String += StrLen (L"GUID="); // @@ -382,7 +382,7 @@ ConstructConfigHdr ( // // Append L"&NAME=" // - StrCpy (String, L"&NAME="); + StrnCpy (String, L"&NAME=", 7); String += StrLen (L"&NAME="); for (Index = 0; Index < NameLength ; Index++) { String += UnicodeSPrint (String, 10, L"00%x", Name[Index]); @@ -391,7 +391,7 @@ ConstructConfigHdr ( // // Append L"&PATH=" // - StrCpy (String, L"&PATH="); + StrnCpy (String, L"&PATH=", 7); String += StrLen (L"&PATH="); for (Index = 0, Buffer = (UINT8 *) DevicePath; Index < DevicePathLength; Index++) { String += UnicodeSPrint (String, 6, L"%02x", *Buffer++); @@ -618,7 +618,7 @@ IfconfigGetAllNicInfoByHii ( goto ON_ERROR; } if (ConfigHdr != NULL) { - StrCpy (ConfigResp, ConfigHdr); + StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100); } // @@ -791,7 +791,7 @@ IfconfigSetNicAddrByHii ( goto ON_EXIT; } if (ConfigHdr != NULL) { - StrCpy (ConfigResp, ConfigHdr); + StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100); } NicConfig = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE); -- 2.39.2