@@ -1870,12 +1870,12 @@ IsValidSplit(
1870
1870
return (EFI_OUT_OF_RESOURCES );
1871
1871
}
1872
1872
TempWalker = (CHAR16 * )Temp ;
1873
- GetNextParameter (& TempWalker , & FirstParameter , StrSize (CmdLine ));
1874
-
1875
- if ( GetOperationType ( FirstParameter ) == Unknown_Invalid ) {
1876
- ShellPrintHiiEx ( -1 , -1 , NULL , STRING_TOKEN ( STR_SHELL_NOT_FOUND ), ShellInfoObject . HiiHandle , FirstParameter );
1877
- SetLastError ( SHELL_NOT_FOUND ) ;
1878
- Status = EFI_NOT_FOUND ;
1873
+ if (! EFI_ERROR ( GetNextParameter (& TempWalker , & FirstParameter , StrSize (CmdLine )))) {
1874
+ if ( GetOperationType ( FirstParameter ) == Unknown_Invalid ) {
1875
+ ShellPrintHiiEx ( -1 , -1 , NULL , STRING_TOKEN ( STR_SHELL_NOT_FOUND ), ShellInfoObject . HiiHandle , FirstParameter );
1876
+ SetLastError ( SHELL_NOT_FOUND );
1877
+ Status = EFI_NOT_FOUND ;
1878
+ }
1879
1879
}
1880
1880
}
1881
1881
@@ -2030,24 +2030,25 @@ DoHelpUpdate(
2030
2030
Walker = * CmdLine ;
2031
2031
while (Walker != NULL && * Walker != CHAR_NULL ) {
2032
2032
LastWalker = Walker ;
2033
- GetNextParameter (& Walker , & CurrentParameter , StrSize (* CmdLine ));
2034
- if (StrStr (CurrentParameter , L"-?" ) == CurrentParameter ) {
2035
- LastWalker [0 ] = L' ' ;
2036
- LastWalker [1 ] = L' ' ;
2037
- NewCommandLine = AllocateZeroPool (StrSize (L"help " ) + StrSize (* CmdLine ));
2038
- if (NewCommandLine == NULL ) {
2039
- Status = EFI_OUT_OF_RESOURCES ;
2033
+ if (!EFI_ERROR (GetNextParameter (& Walker , & CurrentParameter , StrSize (* CmdLine )))) {
2034
+ if (StrStr (CurrentParameter , L"-?" ) == CurrentParameter ) {
2035
+ LastWalker [0 ] = L' ' ;
2036
+ LastWalker [1 ] = L' ' ;
2037
+ NewCommandLine = AllocateZeroPool (StrSize (L"help " ) + StrSize (* CmdLine ));
2038
+ if (NewCommandLine == NULL ) {
2039
+ Status = EFI_OUT_OF_RESOURCES ;
2040
+ break ;
2041
+ }
2042
+
2043
+ //
2044
+ // We know the space is sufficient since we just calculated it.
2045
+ //
2046
+ StrnCpy (NewCommandLine , L"help " , 5 );
2047
+ StrnCat (NewCommandLine , * CmdLine , StrLen (* CmdLine ));
2048
+ SHELL_FREE_NON_NULL (* CmdLine );
2049
+ * CmdLine = NewCommandLine ;
2040
2050
break ;
2041
2051
}
2042
-
2043
- //
2044
- // We know the space is sufficient since we just calculated it.
2045
- //
2046
- StrnCpy (NewCommandLine , L"help " , 5 );
2047
- StrnCat (NewCommandLine , * CmdLine , StrLen (* CmdLine ));
2048
- SHELL_FREE_NON_NULL (* CmdLine );
2049
- * CmdLine = NewCommandLine ;
2050
- break ;
2051
2052
}
2052
2053
}
2053
2054
@@ -2499,27 +2500,30 @@ RunCommand(
2499
2500
return (EFI_OUT_OF_RESOURCES );
2500
2501
}
2501
2502
TempWalker = CleanOriginal ;
2502
- GetNextParameter (& TempWalker , & FirstParameter , StrSize (CleanOriginal ));
2503
-
2504
- //
2505
- // Depending on the first parameter we change the behavior
2506
- //
2507
- switch (Type = GetOperationType (FirstParameter )) {
2508
- case File_Sys_Change :
2509
- Status = ChangeMappedDrive (FirstParameter );
2510
- break ;
2511
- case Internal_Command :
2512
- case Script_File_Name :
2513
- case Efi_Application :
2514
- Status = SetupAndRunCommandOrFile (Type , CleanOriginal , FirstParameter , ShellInfoObject .NewShellParametersProtocol );
2515
- break ;
2516
- default :
2517
- //
2518
- // Whatever was typed, it was invalid.
2519
- //
2520
- ShellPrintHiiEx (-1 , -1 , NULL , STRING_TOKEN (STR_SHELL_NOT_FOUND ), ShellInfoObject .HiiHandle , FirstParameter );
2521
- SetLastError (SHELL_NOT_FOUND );
2522
- break ;
2503
+ if (!EFI_ERROR (GetNextParameter (& TempWalker , & FirstParameter , StrSize (CleanOriginal )))) {
2504
+ //
2505
+ // Depending on the first parameter we change the behavior
2506
+ //
2507
+ switch (Type = GetOperationType (FirstParameter )) {
2508
+ case File_Sys_Change :
2509
+ Status = ChangeMappedDrive (FirstParameter );
2510
+ break ;
2511
+ case Internal_Command :
2512
+ case Script_File_Name :
2513
+ case Efi_Application :
2514
+ Status = SetupAndRunCommandOrFile (Type , CleanOriginal , FirstParameter , ShellInfoObject .NewShellParametersProtocol );
2515
+ break ;
2516
+ default :
2517
+ //
2518
+ // Whatever was typed, it was invalid.
2519
+ //
2520
+ ShellPrintHiiEx (-1 , -1 , NULL , STRING_TOKEN (STR_SHELL_NOT_FOUND ), ShellInfoObject .HiiHandle , FirstParameter );
2521
+ SetLastError (SHELL_NOT_FOUND );
2522
+ break ;
2523
+ }
2524
+ } else {
2525
+ ShellPrintHiiEx (-1 , -1 , NULL , STRING_TOKEN (STR_SHELL_NOT_FOUND ), ShellInfoObject .HiiHandle , FirstParameter );
2526
+ SetLastError (SHELL_NOT_FOUND );
2523
2527
}
2524
2528
2525
2529
SHELL_FREE_NON_NULL (CleanOriginal );
0 commit comments