]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/Shell: Avoid potential null pointer deference
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 28 Mar 2017 02:26:07 +0000 (10:26 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 29 Mar 2017 02:59:44 +0000 (10:59 +0800)
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>
ShellPkg/Application/Shell/Shell.c

index 5a941aabd0c9f8bc7da7a78a33ebfe634456dea9..e91b964d7bf5b914cf7021d6c9fcf409b5a500a8 100644 (file)
@@ -1162,6 +1162,12 @@ LocateStartupScript (
   MapName = ShellInfoObject.NewEfiShellProtocol->GetMapFromDevicePath (&ImageDevicePath);\r
   if (MapName != NULL) {   \r
     StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, MapName, 0);\r
+    if (StartupScriptPath == NULL) {\r
+      //\r
+      // Do not locate the startup script in sys path when out of resource.\r
+      //\r
+      return NULL;\r
+    }\r
     TempSpot = StrStr (StartupScriptPath, L";");\r
     if (TempSpot != NULL) {\r
       *TempSpot = CHAR_NULL;\r