/** @file\r
The implementation for ifcommand shell command.\r
\r
+ Copyright (c) 2013 Hewlett-Packard Development Company, L.P.\r
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
\r
OriString = String;\r
\r
- StrCpy (String, L"&OFFSET=");\r
+ StrnCpy (String, L"&OFFSET=", 9);\r
String += StrLen (L"&OFFSET=");\r
String += UnicodeSPrint (String, 20, L"%x", Offset);\r
\r
- StrCpy (String,L"&WIDTH=");\r
+ StrnCpy (String,L"&WIDTH=", 8);\r
String += StrLen (L"&WIDTH=");\r
String += UnicodeSPrint (String, 20, L"%x", Width);\r
\r
if (Block != NULL) {\r
- StrCpy (String,L"&VALUE=");\r
+ StrnCpy (String,L"&VALUE=", 8);\r
String += StrLen (L"&VALUE=");\r
while ((Width--) != 0) {\r
String += UnicodeSPrint (String, 20, L"%x", Block[Width]);\r
} \r
\r
String = ConfigHdr;\r
- StrCpy (String, L"GUID=");\r
+ StrnCpy (String, L"GUID=", 6);\r
String += StrLen (L"GUID=");\r
\r
//\r
//\r
// Append L"&NAME="\r
//\r
- StrCpy (String, L"&NAME=");\r
+ StrnCpy (String, L"&NAME=", 7);\r
String += StrLen (L"&NAME=");\r
for (Index = 0; Index < NameLength ; Index++) {\r
String += UnicodeSPrint (String, 10, L"00%x", Name[Index]);\r
//\r
// Append L"&PATH="\r
//\r
- StrCpy (String, L"&PATH=");\r
+ StrnCpy (String, L"&PATH=", 7);\r
String += StrLen (L"&PATH=");\r
for (Index = 0, Buffer = (UINT8 *) DevicePath; Index < DevicePathLength; Index++) {\r
String += UnicodeSPrint (String, 6, L"%02x", *Buffer++);\r
goto ON_ERROR;\r
}\r
if (ConfigHdr != NULL) {\r
- StrCpy (ConfigResp, ConfigHdr);\r
+ StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100);\r
}\r
\r
//\r
goto ON_EXIT;\r
}\r
if (ConfigHdr != NULL) {\r
- StrCpy (ConfigResp, ConfigHdr);\r
+ StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100);\r
}\r
\r
NicConfig = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);\r
\r
if (StringNoCaseCompare(&Temp, &DhcpTemp) == 0) {\r
//\r
- // Validate the parameter for DHCP, two valid forms: eth0 DHCP and eth0 DHCP perment\r
+ // Validate the parameter for DHCP, two valid forms: eth0 DHCP and eth0 DHCP permanent\r
//\r
if ((Argc != 2) && (Argc!= 3)) {\r
ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, Temp);\r
}\r
\r
if ((OldConfig != NULL) && (OldConfig->Source == IP4_CONFIG_SOURCE_DHCP) &&\r
- (OldConfig->Perment == Permanent)) {\r
+ (OldConfig->Permanent == Permanent)) {\r
\r
ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INTERFACE_CONFIGURED), gShellNetwork1HiiHandle, Info->Name);\r
ShellStatus = SHELL_ALREADY_STARTED;\r
} else if (StringNoCaseCompare(&Temp, &StaticTemp) == 0) {\r
//\r
// validate the parameter, two forms: eth0 static IP NETMASK GATEWAY and\r
- // eth0 static IP NETMASK GATEWAY perment\r
+ // eth0 static IP NETMASK GATEWAY permanent \r
//\r
if ((Argc != 5) && (Argc != 6)) {\r
ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, Temp);\r
}\r
\r
CopyMem (&Config->NicAddr, &Info->NicAddress, sizeof (NIC_ADDR));\r
- Config->Perment = Permanent;\r
+ Config->Permanent = Permanent;\r
\r
//\r
// Use HII service to set NIC address\r
}\r
\r
ShellPrintHiiEx(-1, -1, NULL,\r
- STRING_TOKEN (STR_IFCONFIG_PERMENT_STATUS),\r
+ STRING_TOKEN (STR_IFCONFIG_PERMANENT_STATUS),\r
gShellNetwork1HiiHandle,\r
- (NicInfo->ConfigInfo->Perment? L"TRUE":L"FALSE")\r
+ (NicInfo->ConfigInfo->Permanent? L"TRUE":L"FALSE")\r
);\r
\r
Ip4Config = &NicInfo->ConfigInfo->Ip4Info;\r
\r
//\r
// The correct command line arguments for setting address are:\r
- // IfConfig -s eth0 DHCP [perment]\r
- // IfConfig -s eth0 static ip netmask gateway [perment]\r
+ // IfConfig -s eth0 DHCP [permanent]\r
+ // IfConfig -s eth0 static ip netmask gateway [permanent]\r
//\r
if (Item == NULL || (CountSubItems(Item) < 2) || (CountSubItems(Item) > 6) || (CountSubItems(Item) == 4)) {\r
ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, L"-s");\r