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