mirror of https://github.com/acidanthera/audk.git
ShellPkg: Fix command-line parsing to start with Argv[0] when comparing passed-in options
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chris Phillips <chrisp@hp.com> Reviewed-By: Olivier Martin <Olivier.Martin@arm.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15432 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
81514a8ad0
commit
e9d19a80af
|
@ -835,9 +835,13 @@ ProcessCommandLine(
|
||||||
ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = FALSE;
|
ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = FALSE;
|
||||||
ShellInfoObject.ShellInitSettings.Delay = 5;
|
ShellInfoObject.ShellInitSettings.Delay = 5;
|
||||||
|
|
||||||
// Start LoopVar at 1 to ignore Argv[0] which is the name of this binary
|
//
|
||||||
// (probably "Shell.efi")
|
// Start LoopVar at 0 to parse only optional arguments at Argv[0]
|
||||||
for (LoopVar = 1 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
|
// and parse other parameters from Argv[1]. This is for use case that
|
||||||
|
// UEFI Shell boot option is created, and OptionalData is provided
|
||||||
|
// that starts with shell command-line options.
|
||||||
|
//
|
||||||
|
for (LoopVar = 0 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
|
||||||
CurrentArg = gEfiShellParametersProtocol->Argv[LoopVar];
|
CurrentArg = gEfiShellParametersProtocol->Argv[LoopVar];
|
||||||
if (UnicodeCollation->StriColl (
|
if (UnicodeCollation->StriColl (
|
||||||
UnicodeCollation,
|
UnicodeCollation,
|
||||||
|
@ -925,6 +929,13 @@ ProcessCommandLine(
|
||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
|
//
|
||||||
|
// First argument should be Shell.efi image name
|
||||||
|
//
|
||||||
|
if (LoopVar == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ShellInfoObject.ShellInitSettings.FileName = AllocateZeroPool(StrSize(CurrentArg));
|
ShellInfoObject.ShellInitSettings.FileName = AllocateZeroPool(StrSize(CurrentArg));
|
||||||
if (ShellInfoObject.ShellInitSettings.FileName == NULL) {
|
if (ShellInfoObject.ShellInitSettings.FileName == NULL) {
|
||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
|
|
Loading…
Reference in New Issue