summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/DxeNetLib
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2016-11-25 14:14:23 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2016-11-28 09:19:40 +0800
commit418373a1cd97abc0c0e3557f7a00105291829e6f (patch)
treed5030a527580fd78ae69c42b0fe7aba913ba9474 /MdeModulePkg/Library/DxeNetLib
parentf17e28c7911f6d2f985e7bb77e1c68cfd79bf056 (diff)
downloadedk2-418373a1cd97abc0c0e3557f7a00105291829e6f.tar.gz
edk2-418373a1cd97abc0c0e3557f7a00105291829e6f.tar.bz2
edk2-418373a1cd97abc0c0e3557f7a00105291829e6f.zip
MdeModulePkg/NetLib: Handle an invalid IPv6 address case
Handle an invalid IPv6 address in NetLibAsciiStrToIp6(), like '2000:aaaa::1com'. Cc: Zhang Lubo <lubo.zhang@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@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> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/DxeNetLib')
-rw-r--r--MdeModulePkg/Library/DxeNetLib/DxeNetLib.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index 0804052fac..0a7117cf9d 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -2832,6 +2832,17 @@ NetLibAsciiStrToIp6 (
TempStr = Ip6Str;
while ((*Ip6Str != '\0') && (*Ip6Str != ':')) {
+ if (Index != 14 && !NET_IS_HEX (*Ip6Str)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Allow the IPv6 with prefix case, e.g. 2000:aaaa::10/24
+ //
+ if (Index == 14 && !NET_IS_HEX (*Ip6Str) && *Ip6Str != '/') {
+ return EFI_INVALID_PARAMETER;
+ }
+
Ip6Str++;
}