mirror of https://github.com/acidanthera/audk.git
ShellPkg: Refine code to make catenae length more precise.
This commit refine the catenae length. A too long catenae length in StrnCat may cause potential buffer overflow while in StrnCatS it may ASSERT. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17747 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
269e0aebcf
commit
6956ecfe1e
|
@ -516,11 +516,11 @@ FileInterfaceStdInRead(
|
|||
StrnCatS( TabStr,
|
||||
(*BufferSize)/sizeof(CHAR16),
|
||||
CurrentString + TabPos,
|
||||
(StringLen - TabPos) * sizeof (CHAR16)
|
||||
StringLen - TabPos
|
||||
);
|
||||
} else {
|
||||
*TabStr = CHAR_NULL;
|
||||
StrnCatS(TabStr, (*BufferSize)/sizeof(CHAR16), CurrentString + TabPos, (StringLen - TabPos) * sizeof (CHAR16));
|
||||
StrnCatS(TabStr, (*BufferSize)/sizeof(CHAR16), CurrentString + TabPos, StringLen - TabPos);
|
||||
}
|
||||
} else {
|
||||
StrCpyS(TabStr, (*BufferSize)/sizeof(CHAR16), CurrentString + TabPos);
|
||||
|
|
Loading…
Reference in New Issue