]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case when AsciiStrToIp4
authorJiaxin Wu <jiaxin.wu@intel.com>
Fri, 18 Nov 2016 07:38:32 +0000 (15:38 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Wed, 23 Nov 2016 06:01:52 +0000 (14:01 +0800)
This patch is used to allow the IPv4 with prefix case.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
MdeModulePkg/Library/DxeNetLib/DxeNetLib.c

index 04d8345a6d45f49ee5ee15e10f2fe0ee96d7ebaa..0804052fac6639d73bcf68f1997a6258275c2067 100644 (file)
@@ -2724,9 +2724,17 @@ NetLibAsciiStrToIp4 (
     TempStr = Ip4Str;\r
 \r
     while ((*Ip4Str != '\0') && (*Ip4Str != '.')) {\r
-      if (!NET_IS_DIGIT (*Ip4Str)) {\r
+      if (Index != 3 && !NET_IS_DIGIT (*Ip4Str)) {\r
         return EFI_INVALID_PARAMETER;\r
       }\r
+      \r
+      //\r
+      // Allow the IPv4 with prefix case, e.g. 192.168.10.10/24 \r
+      //\r
+      if (Index == 3 && !NET_IS_DIGIT (*Ip4Str) && *Ip4Str != '/') {\r
+        return EFI_INVALID_PARAMETER;\r
+      }\r
+      \r
       Ip4Str++;\r
     }\r
 \r