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>
This commit is contained in:
Ruiyu Ni 2017-03-28 10:26:07 +08:00
parent 779cc439e8
commit 15de94cf05
1 changed files with 6 additions and 0 deletions

View File

@ -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;