summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLib/UefiShellLib.c
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-10 19:46:17 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-10 19:46:17 +0000
commit0158294b9b91d349d6842012cf00c9e03213c6f2 (patch)
tree14585d20169ce1812f103f09a13eaa45e1fd5663 /ShellPkg/Library/UefiShellLib/UefiShellLib.c
parentb4b9fbc40e84f066e403497d5e99ad28a56aa113 (diff)
downloadedk2-platforms-0158294b9b91d349d6842012cf00c9e03213c6f2.tar.xz
fixed operator order
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8887 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellLib/UefiShellLib.c')
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 54b6a43e03..66fcc9f89d 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -2005,6 +2005,7 @@ CopyReplace(
IN CONST CHAR16 *FindTarget,
IN CONST CHAR16 *ReplaceWith
){
+ UINTN Size;
if ( (SourceString == NULL)
|| (NewString == NULL)
|| (FindTarget == NULL)
@@ -2018,12 +2019,14 @@ CopyReplace(
while (*SourceString != L'\0') {
if (StrnCmp(SourceString, FindTarget, StrLen(FindTarget)) == 0) {
SourceString += StrLen(FindTarget);
- if ((StrSize(NewString) + (StrLen(ReplaceWith)*sizeof(CHAR16))) > NewSize) {
+ Size = StrSize(NewString);
+ if ((Size + (StrLen(ReplaceWith)*sizeof(CHAR16))) > NewSize) {
return (EFI_BUFFER_TOO_SMALL);
}
StrCat(NewString, ReplaceWith);
} else {
- if (StrSize(NewString) + sizeof(CHAR16) > NewSize) {
+ Size = StrSize(NewString);
+ if (Size + sizeof(CHAR16) > NewSize) {
return (EFI_BUFFER_TOO_SMALL);
}
StrnCat(NewString, SourceString, 1);