mirror of https://github.com/acidanthera/audk.git
ShellPkg: add array index check for shell delay option
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1528 Shell delay option without parameters do not check the index of shell parameter argv. Add index check to avoid invalid pointer references. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
e8959f8100
commit
d3912eb99e
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
This is THE shell (application)
|
This is THE shell (application)
|
||||||
|
|
||||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.<BR>
|
(C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.<BR>
|
||||||
Copyright 2015-2018 Dell Technologies.<BR>
|
Copyright 2015-2018 Dell Technologies.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
|
@ -1002,7 +1002,11 @@ ProcessCommandLine(
|
||||||
) == 0) {
|
) == 0) {
|
||||||
ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = TRUE;
|
ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = TRUE;
|
||||||
// Check for optional delay value following "-delay"
|
// Check for optional delay value following "-delay"
|
||||||
DelayValueStr = gEfiShellParametersProtocol->Argv[LoopVar + 1];
|
if ((LoopVar + 1) >= gEfiShellParametersProtocol->Argc) {
|
||||||
|
DelayValueStr = NULL;
|
||||||
|
} else {
|
||||||
|
DelayValueStr = gEfiShellParametersProtocol->Argv[LoopVar + 1];
|
||||||
|
}
|
||||||
if (DelayValueStr != NULL){
|
if (DelayValueStr != NULL){
|
||||||
if (*DelayValueStr == L':') {
|
if (*DelayValueStr == L':') {
|
||||||
DelayValueStr++;
|
DelayValueStr++;
|
||||||
|
|
Loading…
Reference in New Issue