EFI_FILE_PROTOCOL wrappers for other items (Like Environment Variables,\r
StdIn, StdOut, StdErr, etc...).\r
\r
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2013 Hewlett-Packard Development Company, L.P.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
if (StrStr(CurrentString + TabPos, L":") == NULL) {\r
Cwd = ShellInfoObject.NewEfiShellProtocol->GetCurDir(NULL);\r
if (Cwd != NULL) {\r
- StrnCpy(TabStr, Cwd, (*BufferSize)/sizeof(CHAR16) - 1);\r
+ StrCpyS(TabStr, (*BufferSize)/sizeof(CHAR16), Cwd);\r
if (TabStr[StrLen(TabStr)-1] == L'\\' && *(CurrentString + TabPos) == L'\\' ) {\r
TabStr[StrLen(TabStr)-1] = CHAR_NULL;\r
}\r
- StrnCat(TabStr, CurrentString + TabPos, (StringLen - TabPos) * sizeof (CHAR16));\r
+ StrnCatS( TabStr, \r
+ (*BufferSize)/sizeof(CHAR16), \r
+ CurrentString + TabPos, \r
+ (StringLen - TabPos) * sizeof (CHAR16)\r
+ );\r
} else {\r
*TabStr = CHAR_NULL;\r
- StrnCat(TabStr, CurrentString + TabPos, (StringLen - TabPos) * sizeof (CHAR16));\r
+ StrnCatS(TabStr, (*BufferSize)/sizeof(CHAR16), CurrentString + TabPos, (StringLen - TabPos) * sizeof (CHAR16));\r
}\r
} else {\r
- StrnCpy(TabStr, CurrentString + TabPos, (*BufferSize)/sizeof(CHAR16) - 1);\r
+ StrCpyS(TabStr, (*BufferSize)/sizeof(CHAR16), CurrentString + TabPos);\r
}\r
- StrnCat(TabStr, L"*", (*BufferSize)/sizeof(CHAR16) - 1 - StrLen(TabStr));\r
+ StrnCatS(TabStr, (*BufferSize)/sizeof(CHAR16), L"*", (*BufferSize)/sizeof(CHAR16) - 1 - StrLen(TabStr));\r
FoundFileList = NULL;\r
Status = ShellInfoObject.NewEfiShellProtocol->FindFiles(TabStr, &FoundFileList);\r
for ( TempStr = CurrentString\r
if (FileStringPath == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrnCpy(FileStringPath, ShellInfoObject.ShellInitSettings.FileName, NewSize/sizeof(CHAR16) -1);\r
+ StrCpyS(FileStringPath, NewSize/sizeof(CHAR16), ShellInfoObject.ShellInitSettings.FileName);\r
if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) {\r
- StrnCat(FileStringPath, L" ", NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
- StrnCat(FileStringPath, ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
+ StrnCatS(FileStringPath, NewSize/sizeof(CHAR16), L" ", NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
+ StrnCatS(FileStringPath, NewSize/sizeof(CHAR16), ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
}\r
Status = RunCommand(FileStringPath);\r
FreePool(FileStringPath);\r
; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL\r
; MasterEnvList += StrLen(MasterEnvList) + 1\r
){\r
- StrnCpy(ItemTemp, L"%", ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16))-1);\r
- StrnCat(ItemTemp, MasterEnvList, ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16))-1 - StrLen(ItemTemp));\r
- StrnCat(ItemTemp, L"%", ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16))-1 - StrLen(ItemTemp));\r
+ StrCpyS( ItemTemp, \r
+ ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)), \r
+ L"%"\r
+ );\r
+ StrCatS( ItemTemp, \r
+ ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)), \r
+ MasterEnvList\r
+ );\r
+ StrCatS( ItemTemp, \r
+ ((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)), \r
+ L"%"\r
+ );\r
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, ItemTemp, EfiShellGetEnv(MasterEnvList), TRUE, FALSE);\r
- StrnCpy(NewCommandLine1, NewCommandLine2, NewSize/sizeof(CHAR16)-1);\r
+ StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2);\r
}\r
if (CurrentScriptFile != NULL) {\r
for (AliasListNode = (ALIAS_LIST*)GetFirstNode(&CurrentScriptFile->SubstList)\r
; AliasListNode = (ALIAS_LIST*)GetNextNode(&CurrentScriptFile->SubstList, &AliasListNode->Link)\r
){\r
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, AliasListNode->Alias, AliasListNode->CommandString, TRUE, FALSE);\r
- StrnCpy(NewCommandLine1, NewCommandLine2, NewSize/sizeof(CHAR16)-1);\r
+ StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2);\r
}\r
}\r
\r
// Now cleanup any straggler intentionally ignored "%" characters\r
//\r
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, L"^%", L"%", TRUE, FALSE);\r
- StrnCpy(NewCommandLine1, NewCommandLine2, NewSize/sizeof(CHAR16)-1);\r
+ StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2);\r
\r
FreePool(NewCommandLine2);\r
FreePool(ItemTemp);\r
CHAR16 *Walker;\r
CHAR16 *NewCommandLine;\r
EFI_STATUS Status;\r
+ UINTN NewCmdLineSize;\r
\r
Status = EFI_SUCCESS;\r
\r
if (StrStr(CurrentParameter, L"-?") == CurrentParameter) {\r
CurrentParameter[0] = L' ';\r
CurrentParameter[1] = L' ';\r
- NewCommandLine = AllocateZeroPool(StrSize(L"help ") + StrSize(*CmdLine));\r
+ NewCmdLineSize = StrSize(L"help ") + StrSize(*CmdLine);\r
+ NewCommandLine = AllocateZeroPool(NewCmdLineSize);\r
if (NewCommandLine == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
break;\r
//\r
// We know the space is sufficient since we just calculated it.\r
//\r
- StrnCpy(NewCommandLine, L"help ", 5);\r
- StrnCat(NewCommandLine, *CmdLine, StrLen(*CmdLine));\r
+ StrnCpyS(NewCommandLine, NewCmdLineSize/sizeof(CHAR16), L"help ", 5);\r
+ StrnCatS(NewCommandLine, NewCmdLineSize/sizeof(CHAR16), *CmdLine, StrLen(*CmdLine));\r
SHELL_FREE_NON_NULL(*CmdLine);\r
*CmdLine = NewCommandLine;\r
break;\r
; // conditional increment in the body of the loop\r
){\r
ASSERT(CommandLine2 != NULL);\r
- StrnCpy(CommandLine2, NewScriptFile->CurrentCommand->Cl, PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16)-1);\r
+ StrCpyS( CommandLine2, \r
+ PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16), \r
+ NewScriptFile->CurrentCommand->Cl\r
+ );\r
\r
//\r
// NULL out comments\r
//\r
// Due to variability in starting the find and replace action we need to have both buffers the same.\r
//\r
- StrnCpy(CommandLine, CommandLine2, PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16)-1);\r
+ StrCpyS( CommandLine, \r
+ PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16), \r
+ CommandLine2\r
+ );\r
\r
//\r
// Remove the %0 to %9 from the command line (if we have some arguments)\r
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%8", L"\"\"", FALSE, FALSE);\r
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%9", L"\"\"", FALSE, FALSE);\r
\r
- StrnCpy(CommandLine2, CommandLine, PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16)-1);\r
+ StrCpyS( CommandLine2, \r
+ PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16), \r
+ CommandLine\r
+ );\r
\r
LastCommand = NewScriptFile->CurrentCommand;\r
\r
//\r
// Copy the string into the Key, leaving the last character allocated as NULL to terminate\r
//\r
- StrnCpy(Node->Key, CurrentString, StrStr(CurrentString, L"=") - CurrentString);\r
+ StrCpyS( Node->Key, \r
+ StrStr(CurrentString, L"=") - CurrentString + 1, \r
+ CurrentString\r
+ );\r
\r
//\r
// ValueSize = TotalSize - already removed size - size for '=' + size for terminator (the last 2 items cancel each other)\r
/** @file\r
Provides interface to shell MAN file parser.\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 of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
} else {\r
Buffer = AllocateZeroPool(StrSize(ManFileName) + 4*sizeof(CHAR16));\r
if (Buffer != NULL) {\r
- StrnCpy(Buffer, ManFileName, StrLen(ManFileName));\r
- StrnCat(Buffer, L".man", 4);\r
+ StrnCpyS( Buffer, \r
+ (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16), \r
+ ManFileName, \r
+ StrLen(ManFileName)\r
+ );\r
+ StrnCatS( Buffer, \r
+ (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16),\r
+ L".man", \r
+ 4\r
+ );\r
}\r
}\r
return (Buffer);\r
if (TitleString == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrnCpy(TitleString, StartString, TitleLength/sizeof(CHAR16) - 1);\r
- StrnCat(TitleString, Command, TitleLength/sizeof(CHAR16) - 1 - StrLen(TitleString));\r
- StrnCat(TitleString, EndString, TitleLength/sizeof(CHAR16) - 1 - StrLen(TitleString));\r
+ StrCpyS(TitleString, TitleLength/sizeof(CHAR16), StartString);\r
+ StrCatS(TitleString, TitleLength/sizeof(CHAR16), Command);\r
+ StrCatS(TitleString, TitleLength/sizeof(CHAR16), EndString);\r
\r
CurrentLocation = StrStr(*Buffer, TitleString);\r
if (CurrentLocation == NULL){\r
if (*BriefDesc == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
} else {\r
- StrnCpy(*BriefDesc, CurrentLocation, TitleEnd-CurrentLocation);\r
+ StrnCpyS(*BriefDesc, (*BriefSize)/sizeof(CHAR16), CurrentLocation, TitleEnd-CurrentLocation);\r
}\r
}\r
\r
FreePool(ReadLine);\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrnCpy(TitleString, L".TH ", TitleSize/sizeof(CHAR16) - 1);\r
- StrnCat(TitleString, Command, TitleSize/sizeof(CHAR16) - 1 - StrLen(TitleString));\r
+ StrCpyS(TitleString, TitleSize/sizeof(CHAR16), L".TH ");\r
+ StrCatS(TitleString, TitleSize/sizeof(CHAR16), Command);\r
\r
TitleLen = StrLen(TitleString);\r
for (;!ShellFileHandleEof(Handle);Size = 1024) {\r
Status = EFI_OUT_OF_RESOURCES;\r
break;\r
}\r
- StrnCpy(*BriefDesc, TitleEnd, (*BriefSize)/sizeof(CHAR16) - 1);\r
+ StrCpyS(*BriefDesc, (*BriefSize)/sizeof(CHAR16), TitleEnd);\r
}\r
break;\r
}\r
return (EFI_NOT_FOUND);\r
}\r
\r
- StrnCpy(*TempParameter, (*Walker), NextDelim - *Walker);\r
+ StrnCpyS(*TempParameter, Length, (*Walker), NextDelim - *Walker);\r
\r
//\r
// Add a CHAR_NULL if we didnt get one via the copy\r
//\r
// re-populate the string to support any filenames that were in quotes.\r
//\r
- StrnCpy(CommandLineCopy, NewCommandLine, StrLen(NewCommandLine));\r
+ StrnCpyS(CommandLineCopy, StrSize(CommandLineCopy)/sizeof(CHAR16), NewCommandLine, StrLen(NewCommandLine));\r
\r
if (FirstLocation != CommandLineCopy + StrLen(CommandLineCopy)\r
&& ((UINTN)(FirstLocation - CommandLineCopy) < StrLen(NewCommandLine))\r
if (NewPath == NULL) {\r
return (NULL);\r
}\r
- StrnCpy(NewPath, Cwd, Size/sizeof(CHAR16)-1);\r
+ StrCpyS(NewPath, Size/sizeof(CHAR16), Cwd);\r
if (*Path == L'\\') {\r
Path++;\r
while (PathRemoveLastItem(NewPath)) ;\r
}\r
- StrnCat(NewPath, Path, Size/sizeof(CHAR16) - 1 - StrLen(NewPath));\r
+ StrCatS(NewPath, Size/sizeof(CHAR16), Path);\r
DevicePathForReturn = EfiShellGetDevicePathFromFilePath(NewPath);\r
FreePool(NewPath);\r
return (DevicePathForReturn);\r
\r
CurrentFilePattern = AllocateZeroPool((NextFilePatternStart-FilePattern+1)*sizeof(CHAR16));\r
ASSERT(CurrentFilePattern != NULL);\r
- StrnCpy(CurrentFilePattern, FilePattern, NextFilePatternStart-FilePattern);\r
+ StrCpyS(CurrentFilePattern, NextFilePatternStart-FilePattern+1, FilePattern);\r
\r
if (CurrentFilePattern[0] == CHAR_NULL\r
&&NextFilePatternStart[0] == CHAR_NULL\r
if (NewFullName == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
} else {\r
- StrnCpy(NewFullName, MapName, Size/sizeof(CHAR16)-1);\r
- StrnCat(NewFullName, ShellInfoNode->FullName+1, (Size/sizeof(CHAR16))-StrLen(NewFullName)-1);\r
+ StrCpyS(NewFullName, Size/sizeof(CHAR16), MapName);\r
+ StrCatS(NewFullName, Size/sizeof(CHAR16), ShellInfoNode->FullName+1);\r
FreePool((VOID*)ShellInfoNode->FullName);\r
ShellInfoNode->FullName = NewFullName;\r
}\r
; Node = (ENV_VAR_LIST*)GetNextNode(&List, &Node->Link)\r
){\r
ASSERT(Node->Key != NULL);\r
- StrnCpy(CurrentWriteLocation, Node->Key, (Size)/sizeof(CHAR16) - (CurrentWriteLocation - ((CHAR16*)Buffer)) - 1);\r
+ StrCpyS( CurrentWriteLocation, \r
+ (Size)/sizeof(CHAR16) - (CurrentWriteLocation - ((CHAR16*)Buffer)), \r
+ Node->Key\r
+ );\r
CurrentWriteLocation += StrLen(CurrentWriteLocation) + 1;\r
}\r
\r
FixCommand = AllocateZeroPool(StrSize(Command) - 4 * sizeof (CHAR16));\r
ASSERT(FixCommand != NULL);\r
\r
- StrnCpy(FixCommand, Command, StrLen(Command)-4);\r
+ StrnCpyS( FixCommand, \r
+ (StrSize(Command) - 4 * sizeof (CHAR16))/sizeof(CHAR16), \r
+ Command, \r
+ StrLen(Command)-4\r
+ );\r
Status = ProcessManFile(FixCommand, FixCommand, Sections, NULL, HelpText);\r
FreePool(FixCommand);\r
return Status;\r
/** @file\r
Utility functions used by the Dp application.\r
\r
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.\r
+ Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.\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
UINTN StartIndex;\r
UINTN EndIndex;\r
\r
- ZeroMem (UnicodeBuffer, DXE_PERFORMANCE_STRING_LENGTH * sizeof (CHAR16));\r
+ ZeroMem (UnicodeBuffer, (DP_GAUGE_STRING_LENGTH + 1) * sizeof (CHAR16));\r
\r
if (PdbFileName == NULL) {\r
- StrnCpy (UnicodeBuffer, L" ", 1);\r
+ StrnCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ", 1);\r
} else {\r
StartIndex = 0;\r
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)\r
);\r
if (!EFI_ERROR (Status)) {\r
SHELL_FREE_NON_NULL (PlatformLanguage);\r
- StrnCpy (mGaugeString, StringPtr, DP_GAUGE_STRING_LENGTH);\r
+ StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr);\r
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;\r
return;\r
}\r
//\r
// Method 3. Get the name string from FFS UI section\r
//\r
- StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);\r
+ StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, NameString);\r
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;\r
FreePool (NameString);\r
} else {\r
//\r
NameString = ConvertDevicePathToText (LoadedImageDevicePath, TRUE, FALSE);\r
if (NameString != NULL) {\r
- StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);\r
+ StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, NameString);\r
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;\r
FreePool (NameString);\r
return;\r
//\r
StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAME), NULL);\r
ASSERT (StringPtr != NULL);\r
- StrnCpy (mGaugeString, StringPtr, DP_GAUGE_STRING_LENGTH);\r
+ StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr);\r
FreePool (StringPtr);\r
}\r
\r
/** @file\r
Main file for support of shell consist mapping.\r
\r
- Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2005 - 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
ASSERT (Str->Str != NULL);\r
}\r
\r
- StrnCat (Str->Str, AppendStr, StringSize/sizeof(CHAR16) - 1 - StrLen(Str->Str));\r
+ StrCatS (Str->Str, StringSize/sizeof(CHAR16), AppendStr);\r
Str->Len = StringSize;\r
\r
FreePool (AppendStr);\r
Main file for DmpStore shell Debug1 function.\r
\r
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2005 - 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
FoundVarName = AllocateZeroPool (NameSize);\r
if (FoundVarName != NULL) {\r
if (PrevName != NULL) {\r
- StrnCpy(FoundVarName, PrevName, NameSize/sizeof(CHAR16)-1);\r
+ StrCpyS(FoundVarName, NameSize/sizeof(CHAR16), PrevName);\r
}\r
\r
Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);\r
/** @file\r
Implements filebuffer interface functions.\r
\r
- Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR>\r
+ Copyright (c) 2005 - 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
PrintLine = AllocatePool (BufLen);\r
ASSERT (PrintLine != NULL);\r
\r
- StrnCpy (PrintLine, Buffer, MIN(Limit, MainEditor.ScreenSize.Column));\r
+ StrnCpyS (PrintLine, BufLen/sizeof(CHAR16), Buffer, MIN(Limit, MainEditor.ScreenSize.Column));\r
for (; Limit < MainEditor.ScreenSize.Column; Limit++) {\r
PrintLine[Limit] = L' ';\r
}\r
//\r
if ((High > Low && Key >= Low && Key <= High) \r
|| (Table[Index].Key == Key)) {\r
- StrnCpy (Info, Table[Index].Info, InfoLen-1);\r
- StrnCat (Info, L"\n", InfoLen - 1 - StrLen(Info));\r
+ StrCpyS (Info, InfoLen, Table[Index].Info);\r
+ StrCatS (Info, InfoLen, L"\n");\r
return Key;\r
}\r
}\r
\r
- StrnCpy (Info, L"Undefined Value\n", InfoLen - 1);\r
+ StrCpyS (Info, InfoLen, L"Undefined Value\n");\r
return QUERY_TABLE_UNFOUND;\r
}\r
\r
Main file for Drivers shell Driver1 function.\r
\r
(C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2010 - 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
TruncatedDriverName = NULL;\r
if (!SfoFlag && (FullDriverName != NULL)) {\r
TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16));\r
- StrnCpy (TruncatedDriverName, FullDriverName, MAX_LEN_DRIVER_NAME);\r
+ StrCpyS (TruncatedDriverName, MAX_LEN_DRIVER_NAME + 1, FullDriverName);\r
}\r
\r
ShellPrintEx(\r
Main file for cp shell level 2 function.\r
\r
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\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 of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
// simple copy of a single file\r
//\r
if (Cwd != NULL) {\r
- StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16)-1);\r
+ StrCpyS(DestPath, PathSize / sizeof(CHAR16), Cwd);\r
} else {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); \r
FreePool (CleanFilePathStr);\r
return (SHELL_INVALID_PARAMETER);\r
}\r
if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') {\r
- StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize / sizeof(CHAR16), L"\\");\r
} else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') {\r
((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;\r
}\r
- StrnCat(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);\r
} else {\r
- StrnCpy(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) -1);\r
+ StrCpyS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);\r
}\r
} else {\r
//\r
// Copy to the root of CWD\r
//\r
if (Cwd != NULL) {\r
- StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16) -1);\r
+ StrCpyS(DestPath, PathSize/sizeof(CHAR16), Cwd);\r
} else {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); \r
FreePool(CleanFilePathStr);\r
return (SHELL_INVALID_PARAMETER);\r
}\r
while (PathRemoveLastItem(DestPath));\r
- StrnCat(DestPath, CleanFilePathStr+1, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
- StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr+1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);\r
} else if (StrStr(CleanFilePathStr, L":") == NULL) {\r
if (Cwd != NULL) {\r
- StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16) -1);\r
+ StrCpyS(DestPath, PathSize/sizeof(CHAR16), Cwd);\r
} else {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cp", CleanFilePathStr); \r
FreePool(CleanFilePathStr);\r
return (SHELL_INVALID_PARAMETER);\r
}\r
if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') {\r
- StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");\r
} else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') {\r
((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;\r
}\r
- StrnCat(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);\r
if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') {\r
- StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");\r
} else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') {\r
((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;\r
}\r
- StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);\r
\r
} else {\r
- StrnCpy(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) -1);\r
+ StrCpyS(DestPath, PathSize/sizeof(CHAR16), CleanFilePathStr);\r
if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') {\r
- StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), L"\\");\r
} else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') {\r
((CHAR16*)CleanFilePathStr)[StrLen(CleanFilePathStr)-1] = CHAR_NULL;\r
}\r
- StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1);\r
+ StrCatS(DestPath, PathSize/sizeof(CHAR16), Node->FileName);\r
}\r
}\r
\r
Main file for mv shell level 2 function.\r
\r
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\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 of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
if (DestPath == NULL) {\r
return (SHELL_OUT_OF_RESOURCES);\r
}\r
- StrCpy(DestPath, Cwd);\r
+ StrCpyS(DestPath, StrSize(Cwd) / sizeof(CHAR16), Cwd);\r
while (PathRemoveLastItem(DestPath)) ;\r
\r
//\r
ShellCloseFileMetaArg(&DestList);\r
return (SHELL_OUT_OF_RESOURCES);\r
}\r
- StrCpy(DestPath, Cwd);\r
+ StrCpyS(DestPath, NewSize / sizeof(CHAR16), Cwd);\r
if (DestPath[StrLen(DestPath)-1] != L'\\' && DestParameter[0] != L'\\') {\r
- StrCat(DestPath, L"\\");\r
+ StrCatS(DestPath, NewSize / sizeof(CHAR16), L"\\");\r
} else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestParameter[0] == L'\\') {\r
((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL;\r
}\r
- StrCat(DestPath, DestParameter);\r
+ StrCatS(DestPath, NewSize / sizeof(CHAR16), DestParameter);\r
} else {\r
ASSERT(DestPath == NULL);\r
DestPath = StrnCatGrow(&DestPath, NULL, DestParameter, 0);\r
ShellCloseFileMetaArg(&DestList);\r
return (SHELL_OUT_OF_RESOURCES);\r
}\r
- StrCpy(DestPath, Node->FullName);\r
- StrCat(DestPath, L"\\");\r
+ StrCpyS(DestPath, (StrSize(Node->FullName)+sizeof(CHAR16)) / sizeof(CHAR16), Node->FullName);\r
+ StrCatS(DestPath, (StrSize(Node->FullName)+sizeof(CHAR16)) / sizeof(CHAR16), L"\\");\r
} else {\r
//\r
// cant move multiple files onto a single file.\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
\r
- StrnCpy(*FullDestPath, *DestPath, Size / sizeof(CHAR16) - 1);\r
+ StrCpyS(*FullDestPath, Size / sizeof(CHAR16), *DestPath);\r
if ((*FullDestPath)[StrLen(*FullDestPath)-1] != L'\\' && FileName[0] != L'\\') {\r
- StrnCat(*FullDestPath, L"\\",Size / sizeof(CHAR16) - 1 - StrLen(*FullDestPath));\r
+ StrCatS(*FullDestPath, Size / sizeof(CHAR16), L"\\");\r
}\r
- StrnCat(*FullDestPath, FileName, Size / sizeof(CHAR16) - 1 - StrLen(*FullDestPath));\r
+ StrCatS(*FullDestPath, Size / sizeof(CHAR16), FileName);\r
\r
return (EFI_SUCCESS);\r
}\r
} else {\r
CopyMem(NewFileInfo, Node->Info, SIZE_OF_EFI_FILE_INFO);\r
if (DestPath[0] != L'\\') {\r
- StrCpy(NewFileInfo->FileName, L"\\");\r
- StrCat(NewFileInfo->FileName, DestPath);\r
+ StrCpyS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), L"\\");\r
+ StrCatS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), DestPath);\r
} else {\r
- StrCpy(NewFileInfo->FileName, DestPath);\r
+ StrCpyS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), DestPath);\r
}\r
Length = StrLen(NewFileInfo->FileName);\r
if (Length > 0) {\r
//\r
NewFileInfo->FileName[Length] = CHAR_NULL;\r
}\r
- StrCat(NewFileInfo->FileName, Node->FileName);\r
+ StrCatS(NewFileInfo->FileName, (NewSize - SIZE_OF_EFI_FILE_INFO) / sizeof(CHAR16), Node->FileName);\r
}\r
NewFileInfo->Size = SIZE_OF_EFI_FILE_INFO + StrSize(NewFileInfo->FileName);\r
\r
Main file for attrib shell level 2 function.\r
\r
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\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 of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
if (TempName == NULL) {\r
ShellStatus = SHELL_OUT_OF_RESOURCES;\r
} else {\r
- StrnCpy(TempName, Node->FullName, NewSize/sizeof(CHAR16) -1);\r
+ StrCpyS(TempName, NewSize/sizeof(CHAR16), Node->FullName);\r
TempName[StrStr(TempName, L":")+1-TempName] = CHAR_NULL;\r
- StrnCat(TempName, Node2->FullName, NewSize/sizeof(CHAR16) -1 - StrLen(TempName));\r
+ StrCatS(TempName, NewSize/sizeof(CHAR16), Node2->FullName);\r
FreePool((VOID*)Node2->FullName);\r
Node2->FullName = TempName;\r
\r
Main file for vol shell level 2 function.\r
\r
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2011 - 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
}\r
if (SysInfo != NULL) {\r
- StrnCpy ((CHAR16 *) SysInfo->VolumeLabel, Name, (Size1 > Size2?Size1/sizeof(CHAR16):Size2/sizeof(CHAR16))-1);\r
+ StrCpyS ( (CHAR16 *) SysInfo->VolumeLabel, \r
+ (Size1>Size2? Size1/sizeof(CHAR16) : Size2/sizeof(CHAR16)), \r
+ Name\r
+ );\r
SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + Size1;\r
Status = EfiFpHandle->SetInfo(\r
EfiFpHandle,\r
if (TestPath == NULL) {\r
return (NULL);\r
}\r
- StrnCpy(TestPath, Path, Size/sizeof(CHAR16) - 1);\r
- StrnCat(TestPath, FileName, Size/sizeof(CHAR16) - 1 - StrLen(TestPath));\r
+ StrCpyS(TestPath, Size/sizeof(CHAR16), Path);\r
+ StrCatS(TestPath, Size/sizeof(CHAR16), FileName);\r
Status = ShellOpenFileByName(TestPath, &Handle, EFI_FILE_MODE_READ, 0);\r
if (!EFI_ERROR(Status)){\r
if (FileHandleIsDirectory(Handle) != EFI_SUCCESS) {\r
*TempChar = CHAR_NULL;\r
}\r
if (TestPath[StrLen(TestPath)-1] != L'\\') {\r
- StrnCat(TestPath, L"\\", Size/sizeof(CHAR16) - 1 - StrLen(TestPath));\r
+ StrCatS(TestPath, Size/sizeof(CHAR16), L"\\");\r
}\r
if (FileName[0] == L'\\') {\r
FileName++;\r
}\r
- StrnCat(TestPath, FileName, Size/sizeof(CHAR16) - 1 - StrLen(TestPath));\r
+ StrCatS(TestPath, Size/sizeof(CHAR16), FileName);\r
if (StrStr(Walker, L";") != NULL) {\r
Walker = StrStr(Walker, L";") + 1;\r
} else {\r
return (NULL);\r
}\r
for (ExtensionWalker = FileExtension, TempChar2 = (CHAR16*)FileExtension; TempChar2 != NULL ; ExtensionWalker = TempChar2 + 1){\r
- StrnCpy(TestPath, FileName, Size/sizeof(CHAR16) - 1);\r
+ StrCpyS(TestPath, Size/sizeof(CHAR16), FileName);\r
if (ExtensionWalker != NULL) {\r
- StrnCat(TestPath, ExtensionWalker, Size/sizeof(CHAR16) - 1 - StrLen(TestPath));\r
+ StrCatS(TestPath, Size/sizeof(CHAR16), ExtensionWalker);\r
}\r
TempChar = StrStr(TestPath, L";");\r
if (TempChar != NULL) {\r
CurrentItemPackage->Value = ReallocatePool(ValueSize, CurrentValueSize, CurrentItemPackage->Value);\r
ASSERT(CurrentItemPackage->Value != NULL);\r
if (ValueSize == 0) {\r
- StrnCpy(CurrentItemPackage->Value, Argv[LoopCounter], CurrentValueSize/sizeof(CHAR16) - 1);\r
+ StrCpyS( CurrentItemPackage->Value, \r
+ CurrentValueSize/sizeof(CHAR16), \r
+ Argv[LoopCounter]\r
+ );\r
} else {\r
- StrnCat(CurrentItemPackage->Value, L" ", CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value));\r
- StrnCat(CurrentItemPackage->Value, Argv[LoopCounter], CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value));\r
+ StrCatS( CurrentItemPackage->Value, \r
+ CurrentValueSize/sizeof(CHAR16), \r
+ L" "\r
+ );\r
+ StrCatS( CurrentItemPackage->Value, \r
+ CurrentValueSize/sizeof(CHAR16), \r
+ Argv[LoopCounter]\r
+ );\r
}\r
ValueSize += StrSize(Argv[LoopCounter]) + sizeof(CHAR16);\r
\r
FreePool(Replace);\r
return (EFI_BUFFER_TOO_SMALL);\r
}\r
- StrnCat(NewString, Replace, NewSize/sizeof(CHAR16) - 1 - StrLen(NewString));\r
+ StrCatS(NewString, NewSize/sizeof(CHAR16), Replace);\r
} else {\r
Size = StrSize(NewString);\r
if (Size + sizeof(CHAR16) > NewSize) {\r
FreePool(Replace);\r
return (EFI_BUFFER_TOO_SMALL);\r
}\r
- StrnCat(NewString, SourceString, 1);\r
+ StrnCatS(NewString, NewSize/sizeof(CHAR16), SourceString, 1);\r
SourceString++;\r
}\r
}\r
if (*Destination == NULL) {\r
return (NULL);\r
}\r
- return StrnCat(*Destination, Source, Count);\r
+ \r
+ StrCatS(*Destination, Count + 1, Source);\r
+ return *Destination;\r
}\r
\r
/**\r
The implementation for ifcommand shell command.\r
\r
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2015, 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
Append OFFSET/WIDTH/VALUE items at the beginning of string.\r
\r
@param[in, out] String The pointer to the string to append onto.\r
+ @param[in] MaxLen The max number of UNICODE char in String\r
+ including the terminate NULL char.\r
@param[in] Offset Offset value.\r
@param[in] Width Width value.\r
@param[in] Block Point to data buffer.\r
EFIAPI\r
AppendOffsetWidthValue (\r
IN OUT CHAR16 *String,\r
+ IN UINTN MaxLen,\r
IN UINTN Offset,\r
IN UINTN Width,\r
IN CONST UINT8 *Block\r
\r
OriString = String;\r
\r
- StrnCpy (String, L"&OFFSET=", 9);\r
+ StrnCpyS (String, MaxLen, L"&OFFSET=", 9);\r
String += StrLen (L"&OFFSET=");\r
String += UnicodeSPrint (String, 20, L"%x", Offset);\r
\r
- StrnCpy (String,L"&WIDTH=", 8);\r
+ StrnCpyS (String, MaxLen, L"&WIDTH=", 8);\r
String += StrLen (L"&WIDTH=");\r
String += UnicodeSPrint (String, 20, L"%x", Width);\r
\r
if (Block != NULL) {\r
- StrnCpy (String,L"&VALUE=", 8);\r
+ StrnCpyS (String, MaxLen, L"&VALUE=", 8);\r
String += StrLen (L"&VALUE=");\r
while ((Width--) != 0) {\r
String += UnicodeSPrint (String, 20, L"%x", Block[Width]);\r
{\r
EFI_STATUS Status;\r
CHAR16 *ConfigHdr;\r
+ UINTN ConfigHdrBufferSize;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
CHAR16 *String;\r
UINTN Index;\r
\r
DevicePathLength = GetDevicePathSize (DevicePath);\r
NameLength = StrLen (Name);\r
- ConfigHdr = AllocateZeroPool ((5 + sizeof (EFI_GUID) * 2 + 6 + NameLength * 4 + 6 + DevicePathLength * 2 + 1) * sizeof (CHAR16));\r
+ ConfigHdrBufferSize = (5 + sizeof (EFI_GUID) * 2 + 6 + NameLength * 4 + 6 + DevicePathLength * 2 + 1) * sizeof (CHAR16);\r
+ ConfigHdr = AllocateZeroPool (ConfigHdrBufferSize);\r
if (ConfigHdr == NULL) {\r
return NULL;\r
} \r
\r
String = ConfigHdr;\r
- StrnCpy (String, L"GUID=", 6);\r
+ StrnCpyS (String, ConfigHdrBufferSize/sizeof(CHAR16), L"GUID=", 6);\r
String += StrLen (L"GUID=");\r
\r
//\r
//\r
// Append L"&NAME="\r
//\r
- StrnCpy (String, L"&NAME=", 7);\r
+ StrnCpyS (String, ConfigHdrBufferSize/sizeof(CHAR16), 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
- StrnCpy (String, L"&PATH=", 7);\r
+ StrnCpyS (String, ConfigHdrBufferSize/sizeof(CHAR16), 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
EFI_HANDLE *Handles;\r
UINTN HandleCount;\r
CHAR16 *ConfigResp;\r
+ UINTN ConfigRespBufferSize;\r
CHAR16 *ConfigHdr;\r
UINTN Index;\r
CHAR16 *AccessProgress;\r
} else {\r
Length = 0;\r
}\r
- ConfigResp = AllocateZeroPool ((Length + NIC_ITEM_CONFIG_SIZE * 2 + 100) * sizeof (CHAR16));\r
+ ConfigRespBufferSize = (Length + NIC_ITEM_CONFIG_SIZE * 2 + 100) * sizeof (CHAR16);\r
+ ConfigResp = AllocateZeroPool (ConfigRespBufferSize);\r
if (ConfigResp == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
goto ON_ERROR;\r
}\r
if (ConfigHdr != NULL) {\r
- StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1);\r
+ StrnCpyS (ConfigResp, ConfigRespBufferSize/sizeof(CHAR16), ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1);\r
}\r
\r
//\r
//\r
String = ConfigResp + Length;\r
Offset = 0;\r
- AppendOffsetWidthValue (String, Offset, NIC_ITEM_CONFIG_SIZE, NULL);\r
+ AppendOffsetWidthValue (String, \r
+ ConfigRespBufferSize/sizeof(CHAR16) - Length, \r
+ Offset, \r
+ NIC_ITEM_CONFIG_SIZE, \r
+ NULL\r
+ );\r
\r
NicInfo = AllocateZeroPool (sizeof (NIC_INFO));\r
if (NicInfo == NULL) {\r
SHELL_STATUS ShellStatus;\r
NIC_IP4_CONFIG_INFO *NicConfig;\r
CHAR16 *ConfigResp;\r
+ UINTN ConfigRespBufferSize;\r
CHAR16 *ConfigHdr;\r
CHAR16 *AccessProgress;\r
CHAR16 *AccessResults;\r
ShellStatus = SHELL_OUT_OF_RESOURCES;\r
goto ON_EXIT;\r
}\r
- ConfigResp = AllocateZeroPool ((Length + NIC_ITEM_CONFIG_SIZE * 2 + 100) * sizeof (CHAR16));\r
+ ConfigRespBufferSize = (Length + NIC_ITEM_CONFIG_SIZE * 2 + 100) * sizeof (CHAR16);\r
+ ConfigResp = AllocateZeroPool (ConfigRespBufferSize);\r
if (ConfigResp == NULL) {\r
ShellStatus = SHELL_OUT_OF_RESOURCES;\r
goto ON_EXIT;\r
}\r
if (ConfigHdr != NULL) {\r
- StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1);\r
+ StrnCpyS (ConfigResp, ConfigRespBufferSize/sizeof(CHAR16), ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1);\r
}\r
\r
NicConfig = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);\r
//\r
String = ConfigResp + Length;\r
Offset = 0;\r
- AppendOffsetWidthValue (String, Offset, NIC_ITEM_CONFIG_SIZE, NULL);\r
+ AppendOffsetWidthValue (String, \r
+ ConfigRespBufferSize/sizeof(CHAR16) - Length,\r
+ Offset, \r
+ NIC_ITEM_CONFIG_SIZE, \r
+ NULL\r
+ );\r
\r
//\r
// Call HII helper function to generate configuration string\r