diff options
Diffstat (limited to 'ShellPkg/Application/Shell/Shell.c')
-rw-r--r-- | ShellPkg/Application/Shell/Shell.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 01b4e37..ae3e943 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -395,11 +395,7 @@ UefiMain ( //
// Check PCDs for optional features that are not implemented yet.
//
- if ( PcdGetBool (PcdShellSupportOldProtocols)
- || !FeaturePcdGet (PcdShellRequireHiiPlatform)
- || FeaturePcdGet (PcdShellSupportFrameworkHii)
- )
- {
+ if (!FeaturePcdGet (PcdShellRequireHiiPlatform) || FeaturePcdGet (PcdShellSupportFrameworkHii)) {
return (EFI_UNSUPPORTED);
}
@@ -576,6 +572,11 @@ UefiMain ( Size = 100;
TempString = AllocateZeroPool (Size);
+ if (TempString == NULL) {
+ ASSERT (TempString != NULL);
+ Status = EFI_OUT_OF_RESOURCES;
+ goto FreeResources;
+ }
UnicodeSPrint (TempString, Size, L"%d", PcdGet8 (PcdShellSupportLevel));
Status = InternalEfiShellSetEnv (L"uefishellsupport", TempString, TRUE);
@@ -1261,9 +1262,11 @@ LocateStartupScript ( InternalEfiShellSetEnv (L"homefilesystem", StartupScriptPath, TRUE);
- StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, ((FILEPATH_DEVICE_PATH *)FileDevicePath)->PathName, 0);
- PathRemoveLastItem (StartupScriptPath);
- StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, mStartupScript, 0);
+ if ((DevicePathType (FileDevicePath) == MEDIA_DEVICE_PATH) && (DevicePathSubType (FileDevicePath) == MEDIA_FILEPATH_DP)) {
+ StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, ((FILEPATH_DEVICE_PATH *)FileDevicePath)->PathName, 0);
+ PathRemoveLastItem (StartupScriptPath);
+ StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, mStartupScript, 0);
+ }
}
//
@@ -2609,10 +2612,15 @@ RunCommandOrFile ( CommandWithPath = ShellFindFilePathEx (FirstParameter, mExecutableExtensions);
}
- //
- // This should be impossible now.
- //
- ASSERT (CommandWithPath != NULL);
+ if (CommandWithPath == NULL) {
+ //
+ // This should be impossible now.
+ //
+ ASSERT (CommandWithPath != NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);
+ SetLastError (SHELL_NOT_FOUND);
+ return EFI_NOT_FOUND;
+ }
//
// Make sure that path is not just a directory (or not found)
@@ -3330,8 +3338,8 @@ FindFirstCharacter ( IN CONST CHAR16 EscapeCharacter
)
{
- UINT32 WalkChar;
- UINT32 WalkStr;
+ UINTN WalkChar;
+ UINTN WalkStr;
for (WalkStr = 0; WalkStr < StrLen (String); WalkStr++) {
if (String[WalkStr] == EscapeCharacter) {
|