From: Zhang Lubo <lubo.zhang@intel.com>
To: edk2-devel@lists.01.org
Cc: Fu Siyuan <siyuan.fu@intel.com>, Ye Ting <ting.ye@intel.com>,
Wu Jiaxin <jiaxin.wu@intel.com>,
Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Subject: [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4.
Date: Fri, 19 Aug 2016 15:53:03 +0800 [thread overview]
Message-ID: <1471593183-7776-1-git-send-email-lubo.zhang@intel.com> (raw)
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>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
---
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
next reply other threads:[~2016-08-19 7:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-19 7:53 Zhang Lubo [this message]
2016-08-19 9:54 ` [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4 Hegde, Nagaraj P
2016-08-23 1:21 ` Fu, Siyuan
2016-08-23 1:37 ` Ye, Ting
2016-08-23 3:16 ` Subramanian, Sriram (EG Servers Platform SW)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471593183-7776-1-git-send-email-lubo.zhang@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox