diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2015-06-30 20:15:15 +0000 |
---|---|---|
committer | shenshushi <shenshushi@Edk2> | 2015-06-30 20:15:15 +0000 |
commit | 6956ecfe1e70f241f2a861520568bd1c6639ba54 (patch) | |
tree | d9f96fe52c76aac3404e6b509998e51761a9d830 /ShellPkg | |
parent | 269e0aebcf978640f16361882f423c7b9593215c (diff) | |
download | edk2-6956ecfe1e70f241f2a861520568bd1c6639ba54.zip edk2-6956ecfe1e70f241f2a861520568bd1c6639ba54.tar.gz edk2-6956ecfe1e70f241f2a861520568bd1c6639ba54.tar.bz2 |
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
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Application/Shell/FileHandleWrappers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c index fc68b78..8a71502 100644 --- a/ShellPkg/Application/Shell/FileHandleWrappers.c +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c @@ -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);
|