]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/ShellProtocol: Return error code while fail parsing cmd-line
authorZhichao Gao <zhichao.gao@intel.com>
Fri, 29 Nov 2019 08:51:45 +0000 (16:51 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 19 Dec 2019 05:11:00 +0000 (05:11 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2395

Errors happened in the arguments parsing is not a critical error.
And it would miss the error status code in the release version of shell.
So replace the ASSERT with returning error status code while fail
parsing command-line in UpdateArgcArgv.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Linson Augustine <linson.augustine@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
ShellPkg/Application/Shell/ShellProtocol.c

index 5e529b6568a9fcfdea2057efc67b54bd9bda817c..f0362a42d893ea24daf7e32989841a1589ee0ec6 100644 (file)
@@ -1497,7 +1497,10 @@ InternalShellExecuteDevicePath(
     ShellParamsProtocol.StdOut  = ShellInfoObject.NewShellParametersProtocol->StdOut;\r
     ShellParamsProtocol.StdErr  = ShellInfoObject.NewShellParametersProtocol->StdErr;\r
     Status = UpdateArgcArgv(&ShellParamsProtocol, NewCmdLine, Efi_Application, NULL, NULL);\r
-    ASSERT_EFI_ERROR(Status);\r
+    if (EFI_ERROR (Status)) {\r
+      goto UnloadImage;\r
+    }\r
+\r
     //\r
     // Replace Argv[0] with the full path of the binary we're executing:\r
     // If the command line was "foo", the binary might be called "foo.efi".\r