From d82d59edb0ec23e6ef708e04a5553ac32f1eb12e Mon Sep 17 00:00:00 2001 From: Zhang Lubo Date: Fri, 19 Aug 2016 15:38:20 +0800 Subject: [PATCH] MdeModulePkg:Fix bug in function AsciiStrToIp4. 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 Reviewed-by: Fu Siyuan Reviewed-by: Ye Ting Reviewed-by: Sriram Subramanian --- MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index ef19439a48..7700f0ff82 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -2726,6 +2726,9 @@ NetLibAsciiStrToIp4 ( TempStr = Ip4Str; while ((*Ip4Str != '\0') && (*Ip4Str != '.')) { + if (!NET_IS_DIGIT (*Ip4Str)) { + return EFI_INVALID_PARAMETER; + } Ip4Str++; } -- 2.39.2