When boot from Shell we can use '-delay [num]' as optional data. If blank space 
exist after '[num]' Shell will fail. This patch add error handling to avoid 
this failure.

Cc: Jaben Carsey <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
---
 ShellPkg/Application/Shell/Shell.h                   | 11 +++++++++++
 ShellPkg/Application/Shell/ShellParametersProtocol.c |  1 +
 2 files changed, 12 insertions(+)

diff --git a/ShellPkg/Application/Shell/Shell.h 
b/ShellPkg/Application/Shell/Shell.h
index 4d804fc..b668625 100644
--- a/ShellPkg/Application/Shell/Shell.h
+++ b/ShellPkg/Application/Shell/Shell.h
@@ -360,5 +360,16 @@ FindFirstCharacter(
   IN CONST CHAR16 EscapeCharacter
   );
 
+/**
+  Cleans off leading and trailing spaces and tabs.
+
+  @param[in] String pointer to the string to trim them off.
+**/
+EFI_STATUS
+EFIAPI
+TrimSpaces(
+  IN CHAR16 **String
+  );
+
 #endif //_SHELL_INTERNAL_HEADER_
 
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c 
b/ShellPkg/Application/Shell/ShellParametersProtocol.c
index 1c1367b..bc19df7 100644
--- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
+++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
@@ -359,6 +359,7 @@ CreatePopulateInstallShellParametersProtocol (
     //
     // Populate Argc and Argv
     //
+    TrimSpaces (&FullCommandLine);
     Status = ParseCommandLineToArgs(FullCommandLine,
                                     &(*NewShellParameters)->Argv,
                                     &(*NewShellParameters)->Argc);
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to