summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2016-11-18 15:38:32 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2016-11-23 14:01:52 +0800
commit67bb14259baaf2237b81bcbf2568517b3310b294 (patch)
tree96cc7c303dcfa24559582330db0411b9056451c0 /MdeModulePkg
parent825f09b7621624b7ce68a629371ea64a26560cfb (diff)
downloadedk2-67bb14259baaf2237b81bcbf2568517b3310b294.tar.gz
edk2-67bb14259baaf2237b81bcbf2568517b3310b294.tar.bz2
edk2-67bb14259baaf2237b81bcbf2568517b3310b294.zip
MdeModulePkg/DxeNetLib: Allow the IPv4/prefix case when AsciiStrToIp4
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Library/DxeNetLib/DxeNetLib.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index 04d8345a6d..0804052fac 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -2724,9 +2724,17 @@ NetLibAsciiStrToIp4 (
TempStr = Ip4Str;
while ((*Ip4Str != '\0') && (*Ip4Str != '.')) {
- if (!NET_IS_DIGIT (*Ip4Str)) {
+ if (Index != 3 && !NET_IS_DIGIT (*Ip4Str)) {
return EFI_INVALID_PARAMETER;
}
+
+ //
+ // Allow the IPv4 with prefix case, e.g. 192.168.10.10/24
+ //
+ if (Index == 3 && !NET_IS_DIGIT (*Ip4Str) && *Ip4Str != '/') {
+ return EFI_INVALID_PARAMETER;
+ }
+
Ip4Str++;
}