summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;