summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2017-03-28 10:26:07 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2017-03-29 10:59:44 +0800
commit15de94cf0514a62702b78030a803a0bb607138ff (patch)
treed056c5ec86677e797d164c63b16b91f9a6954c2c /ShellPkg
parent779cc439e881ba2f0be3a12efc955c548e955d8b (diff)
downloadedk2-15de94cf0514a62702b78030a803a0bb607138ff.tar.gz
edk2-15de94cf0514a62702b78030a803a0bb607138ff.tar.bz2
edk2-15de94cf0514a62702b78030a803a0bb607138ff.zip
ShellPkg/Shell: Avoid potential null pointer deference
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Application/Shell/Shell.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index 5a941aabd0..e91b964d7b 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -1162,6 +1162,12 @@ LocateStartupScript (
MapName = ShellInfoObject.NewEfiShellProtocol->GetMapFromDevicePath (&ImageDevicePath);
if (MapName != NULL) {
StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, MapName, 0);
+ if (StartupScriptPath == NULL) {
+ //
+ // Do not locate the startup script in sys path when out of resource.
+ //
+ return NULL;
+ }
TempSpot = StrStr (StartupScriptPath, L";");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;