diff options
author | Zhichao Gao <zhichao.gao@intel.com> | 2019-02-18 16:28:09 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2019-02-22 09:45:23 +0800 |
commit | d3912eb99e88fa1d797e06881fc6589eae831859 (patch) | |
tree | 3e94db7e3005e038fb70b3e0e65bdc1c234048be | |
parent | e8959f81003ccd80317b820f00287897191796ee (diff) | |
download | edk2-d3912eb99e88fa1d797e06881fc6589eae831859.tar.gz edk2-d3912eb99e88fa1d797e06881fc6589eae831859.tar.bz2 edk2-d3912eb99e88fa1d797e06881fc6589eae831859.zip |
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>
-rw-r--r-- | ShellPkg/Application/Shell/Shell.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 104f4c8961..ec344137d3 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 - 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>
Copyright 2015-2018 Dell Technologies.<BR>
This program and the accompanying materials
@@ -1002,7 +1002,11 @@ ProcessCommandLine( ) == 0) {
ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = TRUE;
// 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 == L':') {
DelayValueStr++;
|