Seems like a good check.

Reviewed-by: Jaben Carsey <[email protected]>

> -----Original Message-----
> From: Shah, Tapan [mailto:[email protected]]
> Sent: Wednesday, August 31, 2016 7:24 AM
> To: Bi, Dandan <[email protected]>; [email protected]
> Cc: Ni, Ruiyu <[email protected]>; Carsey, Jaben <[email protected]>
> Subject: RE: [edk2] [patch] ShellPkg: Add the check of parameter number in
> "DrvCfg" command
> Importance: High
> 
> Reviewed-by: Tapan Shah <[email protected]>
> 
> -----Original Message-----
> From: edk2-devel [mailto:[email protected]] On Behalf Of
> Dandan Bi
> Sent: Wednesday, August 31, 2016 12:27 AM
> To: [email protected]
> Cc: Ruiyu Ni <[email protected]>; Jaben Carsey <[email protected]>
> Subject: [edk2] [patch] ShellPkg: Add the check of parameter number in
> "DrvCfg" command
> 
> In shell spec, the usage of "Drvcfg" command is: drvcfg [-l XXX] [-c] [-f
> <Type>|-v|-s] [DriverHandle [DeviceHandle [ChildHandle]]] [-i filename] [-o
> filename]. The parameter number(doesn't include the flags) cannot exceed
> 4, now we add this point to check whether using the command correctly.
> 
> Cc: Ruiyu Ni <[email protected]>
> Cc: Jaben Carsey <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Dandan Bi <[email protected]>
> ---
>  ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
> b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
> index 0d12f01..cc1c9ca 100644
> --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
> +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
> @@ -1210,10 +1210,15 @@ ShellCommandRunDrvCfg (
>          ASSERT(FALSE);
>        }
>      }
>    }
>    if (ShellStatus == SHELL_SUCCESS) {
> +    if (ShellCommandLineGetCount(Package) > 4) {
> +      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY),
> gShellDriver1HiiHandle, L"drvcfg");
> +      ShellStatus = SHELL_INVALID_PARAMETER;
> +      goto Done;
> +    }
>      Lang = ShellCommandLineGetValue(Package, L"-l");
>      if (Lang != NULL) {
>        Language = AllocateZeroPool(StrSize(Lang));
>        AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
>      } else if (ShellCommandLineGetFlag(Package, L"-l")){
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel

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

Reply via email to