Reviewed-by: Ye Ting <[email protected]> -----Original Message----- From: Zhang, Lubo Sent: Friday, August 19, 2016 3:53 PM To: [email protected] Cc: Fu, Siyuan <[email protected]>; Ye, Ting <[email protected]>; Wu, Jiaxin <[email protected]>; Hegde Nagaraj P <[email protected]> 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 <[email protected]> Cc: Fu Siyuan <[email protected]> Cc: Ye Ting <[email protected]> Cc: Wu Jiaxin <[email protected]> Cc: Hegde Nagaraj P <[email protected]> --- 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 ef19439..f4376e9 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -2724,10 +2724,13 @@ NetLibAsciiStrToIp4 ( for (Index = 0; Index < 4; Index++) { TempStr = Ip4Str; while ((*Ip4Str != '\0') && (*Ip4Str != '.')) { + if (!NET_IS_DIGIT(*Ip4Str)) { + return EFI_INVALID_PARAMETER; + } Ip4Str++; } // // The IPv4 address is X.X.X.X -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

