]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg:Fix bug in function AsciiStrToIp4.
authorZhang Lubo <lubo.zhang@intel.com>
Fri, 19 Aug 2016 07:38:20 +0000 (15:38 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Wed, 24 Aug 2016 05:44:02 +0000 (13:44 +0800)
If a FQDN contains 3 dots '.' like "a.b.c.com", the AsciiStrToIp4
will return success as the HostName has a valid IP address. So we
need to check if it is a decimal character before using AsciiStrDecimalToUintn.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
MdeModulePkg/Library/DxeNetLib/DxeNetLib.c

index ef19439a48445960a0d0a64d7d7573a3eb498dab..7700f0ff825f9bc76edd875f085c304ae2b762d2 100644 (file)
@@ -2726,6 +2726,9 @@ NetLibAsciiStrToIp4 (
     TempStr = Ip4Str;\r
 \r
     while ((*Ip4Str != '\0') && (*Ip4Str != '.')) {\r
+      if (!NET_IS_DIGIT (*Ip4Str)) {\r
+        return EFI_INVALID_PARAMETER;\r
+      }\r
       Ip4Str++;\r
     }\r
 \r