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 <jaben.carsey@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16002 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -77,6 +77,7 @@ CascadeDelete(
|
||||
EFI_STATUS Status;
|
||||
SHELL_PROMPT_RESPONSE *Resp;
|
||||
CHAR16 *TempName;
|
||||
UINTN NewSize;
|
||||
|
||||
Resp = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
@ -125,13 +126,14 @@ CascadeDelete(
|
||||
//
|
||||
// Update the node filename to have full path with file system identifier
|
||||
//
|
||||
TempName = AllocateZeroPool(StrSize(Node->FullName) + StrSize(Node2->FullName));
|
||||
NewSize = StrSize(Node->FullName) + StrSize(Node2->FullName);
|
||||
TempName = AllocateZeroPool(NewSize);
|
||||
if (TempName == NULL) {
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
} else {
|
||||
StrCpy(TempName, Node->FullName);
|
||||
StrnCpy(TempName, Node->FullName, NewSize/sizeof(CHAR16) -1);
|
||||
TempName[StrStr(TempName, L":")+1-TempName] = CHAR_NULL;
|
||||
StrCat(TempName, Node2->FullName);
|
||||
StrnCat(TempName, Node2->FullName, NewSize/sizeof(CHAR16) -1 - StrLen(TempName));
|
||||
FreePool((VOID*)Node2->FullName);
|
||||
Node2->FullName = TempName;
|
||||
|
||||
|
Reference in New Issue
Block a user