X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ShellPkg%2FApplication%2FShell%2FShell.c;h=a570b7b1254cc32eb2c67d407eb0fb2c06053505;hp=695880197b0b362fd4f6c34c655d101ec7768767;hb=fdd52bde510a5cb89ce90c307c62e617c10ab7be;hpb=2bbbdc85a3bbc7ec63fc8317fcfbd9bab0006251
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index 695880197b..a570b7b125 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -1,7 +1,7 @@
/** @file
This is THE shell (application)
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
(C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -1381,8 +1381,8 @@ StripUnreplacedEnvironmentVariables(
break;
}
- if (FirstQuote < FirstPercent) {
- SecondQuote = FirstQuote!= NULL?FindNextInstance(FirstQuote+1, L"\"", TRUE):NULL;
+ if (FirstQuote!= NULL && FirstQuote < FirstPercent) {
+ SecondQuote = FindNextInstance(FirstQuote+1, L"\"", TRUE);
//
// Quote is first found
//
@@ -1400,8 +1400,8 @@ StripUnreplacedEnvironmentVariables(
}
continue;
}
- ASSERT(FirstPercent < FirstQuote);
- if (SecondPercent < FirstQuote) {
+
+ if (FirstQuote == NULL || SecondPercent < FirstQuote) {
if (IsValidEnvironmentVariableName(FirstPercent, SecondPercent)) {
//
// We need to remove from FirstPercent to SecondPercent
@@ -1415,7 +1415,6 @@ StripUnreplacedEnvironmentVariables(
}
continue;
}
- ASSERT(FirstQuote < SecondPercent);
CurrentLocator = FirstQuote;
}
return (EFI_SUCCESS);
@@ -1530,13 +1529,13 @@ ShellConvertVariables (
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, AliasListNode->Alias, AliasListNode->CommandString, TRUE, FALSE);
StrnCpy(NewCommandLine1, NewCommandLine2, NewSize/sizeof(CHAR16)-1);
}
-
- //
- // Remove non-existant environment variables in scripts only
- //
- StripUnreplacedEnvironmentVariables(NewCommandLine1);
}
+ //
+ // Remove non-existant environment variables
+ //
+ StripUnreplacedEnvironmentVariables(NewCommandLine1);
+
//
// Now cleanup any straggler intentionally ignored "%" characters
//