Reviewed-by: Fu Siyuan <siyuan...@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Jiaxin Wu
> Sent: Friday, November 18, 2016 3:40 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Fu,
> Siyuan <siyuan...@intel.com>
> Subject: [edk2] [Patch] MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case
> when AsciiStrToIp4
> 
> This patch is used to allow the IPv4 with prefix case.
> 
> Cc: Fu Siyuan <siyuan...@intel.com>
> Cc: Ye Ting <ting...@intel.com>
> Cc: Zhang Lubo <lubo.zh...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
> ---
>  MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> index 04d8345..0804052 100644
> --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> @@ -2722,13 +2722,21 @@ NetLibAsciiStrToIp4 (
> 
>    for (Index = 0; Index < 4; Index++) {
>      TempStr = Ip4Str;
> 
>      while ((*Ip4Str != '\0') && (*Ip4Str != '.')) {
> -      if (!NET_IS_DIGIT (*Ip4Str)) {
> +      if (Index != 3 && !NET_IS_DIGIT (*Ip4Str)) {
>          return EFI_INVALID_PARAMETER;
>        }
> +
> +      //
> +      // Allow the IPv4 with prefix case, e.g. 192.168.10.10/24
> +      //
> +      if (Index == 3 && !NET_IS_DIGIT (*Ip4Str) && *Ip4Str != '/') {
> +        return EFI_INVALID_PARAMETER;
> +      }
> +
>        Ip4Str++;
>      }
> 
>      //
>      // The IPv4 address is X.X.X.X
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to