ShellPkg: Refine code to use Strn**S safe functions instead of Str**S ones in some cases.
Safe string functions may ASSERT when the source length is larger than the MaxDest. This patch use Strn**S to indicate the copy length. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Tapan Shah <<tapandshah@hp.com>> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17894 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -406,7 +406,7 @@ CascadeProcessVariables (
|
||||
FoundVarName = AllocateZeroPool (NameSize);
|
||||
if (FoundVarName != NULL) {
|
||||
if (PrevName != NULL) {
|
||||
StrCpyS(FoundVarName, NameSize/sizeof(CHAR16), PrevName);
|
||||
StrnCpyS(FoundVarName, NameSize/sizeof(CHAR16), PrevName, NameSize/sizeof(CHAR16) - 1);
|
||||
}
|
||||
|
||||
Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
|
||||
|
Reference in New Issue
Block a user