diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2018-08-03 10:42:45 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2018-08-06 10:12:13 +0800 |
commit | c1f032cd3a95ed74dad27d848526495e5790d4af (patch) | |
tree | c0f33d517c99a7f1ec9db51d8c146afa1d99c8f7 /MdePkg | |
parent | 526dd0245bf0db6a01c21943201a4572747bca7f (diff) | |
download | edk2-c1f032cd3a95ed74dad27d848526495e5790d4af.zip edk2-c1f032cd3a95ed74dad27d848526495e5790d4af.tar.gz edk2-c1f032cd3a95ed74dad27d848526495e5790d4af.tar.bz2 |
MdePkg/BaseLib: Add an additional check within AsciiStriCmp
This commit adds an addtional check in AsciiStriCmp. It
explicitly checks the end of the sting pointed by 'SecondString' to make
the code logic easier for reading and to prevent possible mis-reports by
static code checkers.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <Hao.a.wu@intel.com>
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Library/BaseLib/String.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c index e7fe513..cb90774 100644 --- a/MdePkg/Library/BaseLib/String.c +++ b/MdePkg/Library/BaseLib/String.c @@ -1262,7 +1262,7 @@ AsciiStriCmp ( UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
- while ((*FirstString != '\0') && (UpperFirstString == UpperSecondString)) {
+ while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) {
FirstString++;
SecondString++;
UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
|