if (StrStr(CurrentString + TabPos, L":") == NULL) {\r
Cwd = ShellInfoObject.NewEfiShellProtocol->GetCurDir(NULL);\r
if (Cwd != NULL) {\r
- StrCpy(TabStr, Cwd);\r
+ StrnCpy(TabStr, Cwd, (*BufferSize)/sizeof(CHAR16) - 1);\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
} else {\r
- StrCpy(TabStr, L"");\r
+ *TabStr = CHAR_NULL;\r
StrnCat(TabStr, CurrentString + TabPos, (StringLen - TabPos) * sizeof (CHAR16));\r
}\r
} else {\r
- StrCpy(TabStr, CurrentString + TabPos);\r
+ StrnCpy(TabStr, CurrentString + TabPos, (*BufferSize)/sizeof(CHAR16) - 1);\r
}\r
- StrCat(TabStr, L"*");\r
+ StrnCat(TabStr, L"*", (*BufferSize)/sizeof(CHAR16) - 1 - StrLen(TabStr));\r
FoundFileList = NULL;\r
-// TabStr = PathCleanUpDirectories(TabStr);\r
Status = ShellInfoObject.NewEfiShellProtocol->FindFiles(TabStr, &FoundFileList);\r
for ( TempStr = CurrentString\r
; *TempStr == L' '\r
EnvFileInterface->Delete = FileInterfaceEnvDelete;\r
EnvFileInterface->Read = FileInterfaceEnvRead;\r
\r
- StrCpy(EnvFileInterface->Name, EnvName);\r
+ StrnCpy(EnvFileInterface->Name, EnvName, StrLen(EnvName));\r
\r
//\r
// Assign the different members for Volatile and Non-Volatile variables\r
continue;\r
}\r
\r
- ShellInfoObject.ShellInitSettings.FileName = AllocateZeroPool(StrSize(CurrentArg));\r
+ ShellInfoObject.ShellInitSettings.FileName = AllocateCopyPool(StrSize(CurrentArg), CurrentArg);\r
if (ShellInfoObject.ShellInitSettings.FileName == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
// We found `file-name`.\r
//\r
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup = 1;\r
-\r
- StrCpy (ShellInfoObject.ShellInitSettings.FileName, CurrentArg);\r
LoopVar++;\r
\r
// Add `file-name-options`\r
if (FileStringPath == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrCpy(FileStringPath, ShellInfoObject.ShellInitSettings.FileName);\r
+ StrnCpy(FileStringPath, ShellInfoObject.ShellInitSettings.FileName, NewSize/sizeof(CHAR16) -1);\r
if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) {\r
- StrCat(FileStringPath, L" ");\r
- StrCat(FileStringPath, ShellInfoObject.ShellInitSettings.FileOptions);\r
+ StrnCat(FileStringPath, L" ", NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
+ StrnCat(FileStringPath, ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
}\r
Status = RunCommand(FileStringPath, ExitStatus);\r
FreePool(FileStringPath);\r
\r
Node = AllocateZeroPool(sizeof(BUFFER_LIST));\r
ASSERT(Node != NULL);\r
- Node->Buffer = AllocateZeroPool(StrSize(Buffer));\r
+ Node->Buffer = AllocateCopyPool(StrSize(Buffer), Buffer);\r
ASSERT(Node->Buffer != NULL);\r
- StrCpy(Node->Buffer, Buffer);\r
\r
InsertTailList(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link);\r
}\r
return (EFI_SUCCESS);\r
}\r
FreePool(*CommandString);\r
- *CommandString = AllocateZeroPool(StrSize(NewString));\r
+ *CommandString = AllocateCopyPool(StrSize(NewString), NewString);\r
if (*CommandString == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrCpy(*CommandString, NewString);\r
return (EFI_SUCCESS);\r
}\r
\r
//\r
// now do the replacements...\r
//\r
- NewCommandLine1 = AllocateZeroPool(NewSize);\r
+ NewCommandLine1 = AllocateCopyPool(NewSize, OriginalCommandLine);\r
NewCommandLine2 = AllocateZeroPool(NewSize);\r
ItemTemp = AllocateZeroPool(ItemSize+(2*sizeof(CHAR16)));\r
if (NewCommandLine1 == NULL || NewCommandLine2 == NULL || ItemTemp == NULL) {\r
SHELL_FREE_NON_NULL(ItemTemp);\r
return (NULL);\r
}\r
- StrCpy(NewCommandLine1, OriginalCommandLine);\r
for (MasterEnvList = EfiShellGetEnv(NULL)\r
- ; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL //&& *(MasterEnvList+1) != CHAR_NULL\r
+ ; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL\r
; MasterEnvList += StrLen(MasterEnvList) + 1\r
){\r
- StrCpy(ItemTemp, L"%");\r
- StrCat(ItemTemp, MasterEnvList);\r
- StrCat(ItemTemp, L"%");\r
+ *ItemTemp = L'%';\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
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, ItemTemp, EfiShellGetEnv(MasterEnvList), TRUE, FALSE);\r
- StrCpy(NewCommandLine1, NewCommandLine2);\r
+ StrnCpy(NewCommandLine1, NewCommandLine2, NewSize/sizeof(CHAR16)-1);\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
- StrCpy(NewCommandLine1, NewCommandLine2);\r
+ StrnCpy(NewCommandLine1, NewCommandLine2, NewSize/sizeof(CHAR16)-1);\r
}\r
\r
//\r
// Now cleanup any straggler intentionally ignored "%" characters\r
//\r
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, L"^%", L"%", TRUE, FALSE);\r
- StrCpy(NewCommandLine1, NewCommandLine2);\r
+ StrnCpy(NewCommandLine1, NewCommandLine2, NewSize/sizeof(CHAR16)-1);\r
\r
FreePool(NewCommandLine2);\r
FreePool(ItemTemp);\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
TempWalker = (CHAR16*)Temp;\r
- GetNextParameter(&TempWalker, &FirstParameter);\r
+ GetNextParameter(&TempWalker, &FirstParameter, StrSize(CmdLine));\r
\r
if (GetOperationType(FirstParameter) == Unknown_Invalid) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);\r
Walker = *CmdLine;\r
while(Walker != NULL && *Walker != CHAR_NULL) {\r
LastWalker = Walker;\r
- GetNextParameter(&Walker, &CurrentParameter);\r
+ GetNextParameter(&Walker, &CurrentParameter, StrSize(*CmdLine));\r
if (StrStr(CurrentParameter, L"-?") == CurrentParameter) {\r
LastWalker[0] = L' ';\r
LastWalker[1] = L' ';\r
Status = EFI_OUT_OF_RESOURCES;\r
break;\r
}\r
- StrCpy(NewCommandLine, L"help ");\r
- StrCat(NewCommandLine, *CmdLine);\r
+\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
SHELL_FREE_NON_NULL(*CmdLine);\r
*CmdLine = NewCommandLine;\r
break;\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
TempWalker = CleanOriginal;\r
- GetNextParameter(&TempWalker, &FirstParameter);\r
+ GetNextParameter(&TempWalker, &FirstParameter, StrSize(CleanOriginal));\r
\r
//\r
// Depending on the first parameter we change the behavior\r
; // conditional increment in the body of the loop\r
){\r
ASSERT(CommandLine2 != NULL);\r
- StrCpy(CommandLine2, NewScriptFile->CurrentCommand->Cl);\r
+ StrnCpy(CommandLine2, NewScriptFile->CurrentCommand->Cl, PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16)-1);\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
- StrCpy(CommandLine, CommandLine2);\r
+ StrnCpy(CommandLine, CommandLine2, PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16)-1);\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
- StrCpy(CommandLine2, CommandLine);\r
+ StrnCpy(CommandLine2, CommandLine, PcdGet16(PcdShellPrintBufferSize)/sizeof(CHAR16)-1);\r
\r
LastCommand = NewScriptFile->CurrentCommand;\r
\r
if (VariableName == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrCpy(VariableName, L"");\r
+ *VariableName = CHAR_NULL;\r
\r
while (!EFI_ERROR(Status)) {\r
NameSize = (UINTN)MaxVarSize;\r
}\r
}\r
if (!EFI_ERROR(Status) && VarList != NULL) {\r
- VarList->Key = AllocateZeroPool(StrSize(VariableName));\r
+ VarList->Key = AllocateCopyPool(StrSize(VariableName), VariableName);\r
if (VarList->Key == NULL) {\r
SHELL_FREE_NON_NULL(VarList->Val);\r
SHELL_FREE_NON_NULL(VarList);\r
Status = EFI_OUT_OF_RESOURCES;\r
} else {\r
- StrCpy(VarList->Key, VariableName);\r
InsertTailList(ListHead, &VarList->Link);\r
}\r
}\r
UINTN CurrentCount;\r
ENV_VAR_LIST *VarList;\r
ENV_VAR_LIST *Node;\r
- UINTN NewSize;\r
\r
VarList = NULL;\r
\r
}\r
ASSERT(StrStr(CurrentString, L"=") != NULL);\r
Node = AllocateZeroPool(sizeof(ENV_VAR_LIST));\r
- ASSERT(Node != NULL);\r
+ if (Node == NULL) {\r
+ SetEnvironmentVariableList(&VarList->Link);\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
+\r
Node->Key = AllocateZeroPool((StrStr(CurrentString, L"=") - CurrentString + 1) * sizeof(CHAR16));\r
- ASSERT(Node->Key != NULL);\r
+ if (Node->Key == NULL) {\r
+ SHELL_FREE_NON_NULL(Node);\r
+ SetEnvironmentVariableList(&VarList->Link);\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\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
- NewSize = StrSize(CurrentString);\r
- NewSize -= StrLen(Node->Key) - 1;\r
- Node->Val = AllocateZeroPool(NewSize);\r
- ASSERT(Node->Val != NULL);\r
- StrCpy(Node->Val, CurrentString + StrLen(Node->Key) + 1);\r
+\r
+ //\r
+ // ValueSize = TotalSize - already removed size - size for '=' + size for terminator (the last 2 items cancel each other)\r
+ //\r
+ Node->Val = AllocateCopyPool(StrSize(CurrentString) - StrSize(Node->Key), CurrentString + StrLen(Node->Key) + 1);\r
+ if (Node->Val == NULL) {\r
+ SHELL_FREE_NON_NULL(Node->Key);\r
+ SHELL_FREE_NON_NULL(Node);\r
+ SetEnvironmentVariableList(&VarList->Link);\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
+\r
Node->Atts = EFI_VARIABLE_BOOTSERVICE_ACCESS;\r
\r
if (VarList == NULL) {\r
VarList = AllocateZeroPool(sizeof(ENV_VAR_LIST));\r
- ASSERT(VarList != NULL);\r
+ if (VarList == NULL) {\r
+ SHELL_FREE_NON_NULL(Node->Key);\r
+ SHELL_FREE_NON_NULL(Node->Val);\r
+ SHELL_FREE_NON_NULL(Node);\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
InitializeListHead(&VarList->Link);\r
}\r
InsertTailList(&VarList->Link, &Node->Link);\r
/** @file\r
Provides interface to shell MAN file parser.\r
\r
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2014, 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
// Fix the file name\r
//\r
if (StrnCmp(ManFileName+StrLen(ManFileName)-4, L".man", 4)==0) {\r
- Buffer = AllocateZeroPool(StrSize(ManFileName));\r
- if (Buffer != NULL) {\r
- StrCpy(Buffer, ManFileName);\r
- }\r
+ Buffer = AllocateCopyPool(StrSize(ManFileName), ManFileName);\r
} else {\r
Buffer = AllocateZeroPool(StrSize(ManFileName) + 4*sizeof(CHAR16));\r
if (Buffer != NULL) {\r
- StrCpy(Buffer, ManFileName);\r
- StrCat(Buffer, L".man");\r
+ StrnCpy(Buffer, ManFileName, StrLen(ManFileName));\r
+ StrnCat(Buffer, L".man", 4);\r
}\r
}\r
return (Buffer);\r
CHAR16 *TitleString;\r
CHAR16 *TitleEnd;\r
CHAR16 *CurrentLocation;\r
+ UINTN TitleLength;\r
+ CONST CHAR16 StartString[] = L".TH ";\r
+ CONST CHAR16 EndString[] = L" 0 ";\r
\r
if ( Buffer == NULL\r
|| Command == NULL\r
\r
Status = EFI_SUCCESS;\r
\r
- TitleString = AllocateZeroPool((7*sizeof(CHAR16)) + StrSize(Command));\r
+ //\r
+ // more characters for StartString and EndString\r
+ //\r
+ TitleLength = StrSize(Command) + (StrLen(StartString) + StrLen(EndString)) * sizeof(CHAR16);\r
+ TitleString = AllocateZeroPool(TitleLength);\r
if (TitleString == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrCpy(TitleString, L".TH ");\r
- StrCat(TitleString, Command);\r
- StrCat(TitleString, L" 0 ");\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
\r
CurrentLocation = StrStr(*Buffer, TitleString);\r
if (CurrentLocation == NULL){\r
CHAR16 *TitleEnd;\r
UINTN TitleLen;\r
BOOLEAN Found;\r
+ UINTN TitleSize;\r
\r
if ( Handle == NULL\r
|| Command == NULL\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
\r
- TitleString = AllocateZeroPool((4*sizeof(CHAR16)) + StrSize(Command));\r
+ TitleSize = (4*sizeof(CHAR16)) + StrSize(Command);\r
+ TitleString = AllocateZeroPool(TitleSize);\r
if (TitleString == NULL) {\r
FreePool(ReadLine);\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrCpy(TitleString, L".TH ");\r
- StrCat(TitleString, Command);\r
+ StrnCpy(TitleString, L".TH ", TitleSize/sizeof(CHAR16) - 1);\r
+ StrnCat(TitleString, Command, TitleSize/sizeof(CHAR16) - 1 - StrLen(TitleString));\r
\r
TitleLen = StrLen(TitleString);\r
for (;!ShellFileHandleEof(Handle);Size = 1024) {\r
Status = EFI_OUT_OF_RESOURCES;\r
break;\r
}\r
- StrCpy(*BriefDesc, TitleEnd);\r
+ StrnCpy(*BriefDesc, TitleEnd, (*BriefSize)/sizeof(CHAR16) - 1);\r
}\r
break;\r
}\r
VOID\r
EFIAPI\r
GetNextParameter(\r
- CHAR16 **Walker,\r
- CHAR16 **TempParameter\r
+ IN OUT CHAR16 **Walker,\r
+ IN OUT CHAR16 **TempParameter,\r
+ IN CONST UINTN Length\r
)\r
{\r
CHAR16 *NextDelim;\r
//\r
// found ""\r
//\r
- StrCpy(*TempParameter, L"");\r
+ *(*TempParameter) = CHAR_NULL;\r
*Walker = NextDelim + 1;\r
} else if (NextDelim != NULL) {\r
\r
//\r
// last one... someone forgot the training quote!\r
//\r
- StrCpy(*TempParameter, *Walker);\r
+ StrnCpy(*TempParameter, *Walker, Length/sizeof(CHAR16) - 1);\r
*Walker = NULL;\r
}\r
for (TempLoc = *TempParameter ; TempLoc != NULL && *TempLoc != CHAR_NULL ; TempLoc++) {\r
//\r
// last one.\r
//\r
- StrCpy(*TempParameter, *Walker);\r
+ StrnCpy(*TempParameter, *Walker, Length/sizeof(CHAR16) - 1);\r
*Walker = NULL;\r
}\r
for (NextDelim = *TempParameter ; NextDelim != NULL && *NextDelim != CHAR_NULL ; NextDelim++) {\r
for ( Count = 0\r
, Walker = (CHAR16*)CommandLine\r
; Walker != NULL && *Walker != CHAR_NULL\r
- ; GetNextParameter(&Walker, &TempParameter)\r
+ ; GetNextParameter(&Walker, &TempParameter, Size)\r
, Count++\r
);\r
\r
-/* Count = 0;\r
- Walker = (CHAR16*)CommandLine;\r
- while(Walker != NULL) {\r
- GetNextParameter(&Walker, &TempParameter);\r
- Count++;\r
- }\r
-*/\r
//\r
// lets allocate the pointer array\r
//\r
Walker = (CHAR16*)CommandLine;\r
while(Walker != NULL && *Walker != CHAR_NULL) {\r
SetMem16(TempParameter, Size, CHAR_NULL);\r
- GetNextParameter(&Walker, &TempParameter);\r
- NewParam = AllocateZeroPool(StrSize(TempParameter));\r
- ASSERT(NewParam != NULL);\r
- StrCpy(NewParam, TempParameter);\r
+ GetNextParameter(&Walker, &TempParameter, Size);\r
+ NewParam = AllocateCopyPool(StrSize(TempParameter), TempParameter);\r
+ if (NewParam == NULL){\r
+ SHELL_FREE_NON_NULL(TempParameter);\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
((CHAR16**)(*Argv))[(*Argc)] = NewParam;\r
(*Argc)++;\r
}\r
//\r
// re-populate the string to support any filenames that were in quotes.\r
//\r
- StrCpy(CommandLineCopy, NewCommandLine);\r
+ StrnCpy(CommandLineCopy, NewCommandLine, StrLen(NewCommandLine));\r
\r
if (FirstLocation != CommandLineCopy + StrLen(CommandLineCopy)\r
&& ((UINTN)(FirstLocation - CommandLineCopy) < StrLen(NewCommandLine))\r
@param[in, out] Walker pointer to string of command line. Adjusted to\r
reminaing command line on return\r
@param[in, out] TempParameter pointer to string of command line item extracted.\r
+ @param[in] Length Length of (*TempParameter) in bytes\r
\r
**/\r
VOID\r
EFIAPI\r
GetNextParameter(\r
- CHAR16 **Walker,\r
- CHAR16 **TempParameter\r
+ IN OUT CHAR16 **Walker,\r
+ IN OUT CHAR16 **TempParameter,\r
+ IN CONST UINTN Length\r
);\r
\r
#endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_\r
if (Cwd == NULL) {\r
return (NULL);\r
}\r
- Size = StrSize(Cwd);\r
- Size += StrSize(Path);\r
+ Size = StrSize(Cwd) + StrSize(Path) - sizeof(CHAR16);\r
NewPath = AllocateZeroPool(Size);\r
if (NewPath == NULL) {\r
return (NULL);\r
}\r
- StrCpy(NewPath, Cwd);\r
+ StrnCpy(NewPath, Cwd, Size/sizeof(CHAR16)-1);\r
if (*Path == L'\\') {\r
Path++;\r
while (PathRemoveLastItem(NewPath)) ;\r
}\r
- StrCat(NewPath, Path);\r
+ StrnCat(NewPath, Path, Size/sizeof(CHAR16) - 1 - StrLen(NewPath));\r
DevicePathForReturn = EfiShellGetDevicePathFromFilePath(NewPath);\r
FreePool(NewPath);\r
return (DevicePathForReturn);\r
if (NewNode == NULL) {\r
return (NULL);\r
}\r
- NewNode->FullName = AllocateZeroPool(StrSize(Node->FullName));\r
-\r
- NewNode->FileName = AllocateZeroPool(StrSize(Node->FileName));\r
- NewNode->Info = AllocateZeroPool((UINTN)Node->Info->Size);\r
+ NewNode->FullName = AllocateCopyPool(StrSize(Node->FullName), Node->FullName);\r
+ NewNode->FileName = AllocateCopyPool(StrSize(Node->FileName), Node->FileName);\r
+ NewNode->Info = AllocateCopyPool((UINTN)Node->Info->Size, Node->Info);\r
if ( NewNode->FullName == NULL\r
|| NewNode->FileName == NULL\r
|| NewNode->Info == NULL\r
if (!Save) {\r
Node->Handle = NULL;\r
}\r
- StrCpy((CHAR16*)NewNode->FullName, Node->FullName);\r
- StrCpy((CHAR16*)NewNode->FileName, Node->FileName);\r
- CopyMem(NewNode->Info, Node->Info, (UINTN)Node->Info->Size);\r
\r
return((EFI_SHELL_FILE_INFO*)NewNode);\r
}\r
}\r
SHELL_FREE_NON_NULL(BasePath);\r
return(Status);\r
-}\r
+ }\r
\r
/**\r
Get the GUID value from a human readable name.\r
if (NewFullName == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
} else {\r
- StrCpy(NewFullName, MapName);\r
- StrCat(NewFullName, ShellInfoNode->FullName+1);\r
+ StrnCpy(NewFullName, MapName, Size/sizeof(CHAR16)-1);\r
+ StrnCat(NewFullName, ShellInfoNode->FullName+1, (Size/sizeof(CHAR16))-StrLen(NewFullName)-1);\r
FreePool((VOID*)ShellInfoNode->FullName);\r
ShellInfoNode->FullName = NewFullName;\r
}\r
RootDevicePath = NULL;\r
RootFileHandle = NULL;\r
MapName = NULL;\r
- PatternCopy = AllocateZeroPool(StrSize(FilePattern));\r
+ PatternCopy = AllocateCopyPool(StrSize(FilePattern), FilePattern);\r
if (PatternCopy == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
- StrCpy(PatternCopy, FilePattern);\r
\r
PatternCopy = PathCleanUpDirectories(PatternCopy);\r
\r
; Node = (ENV_VAR_LIST*)GetNextNode(&List, &Node->Link)\r
){\r
ASSERT(Node->Key != NULL);\r
- StrCpy(CurrentWriteLocation, Node->Key);\r
+ StrnCpy(CurrentWriteLocation, Node->Key, (Size)/sizeof(CHAR16) - (CurrentWriteLocation - ((CHAR16*)Buffer)) - 1);\r
CurrentWriteLocation += StrLen(CurrentWriteLocation) + 1;\r
}\r
\r
// Allocate the space and recall the get function\r
//\r
Buffer = AllocateZeroPool(Size);\r
- ASSERT(Buffer != NULL);\r
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(Name, Attributes, &Size, Buffer);\r
}\r
//\r