Skip to content

Commit

Permalink
ShellPkg/Shell: Avoid potential null pointer deference
Browse files Browse the repository at this point in the history
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
  • Loading branch information
niruiyu committed Mar 29, 2017
1 parent 779cc43 commit 15de94c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ShellPkg/Application/Shell/Shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 15de94c

Please sign in to comment.