summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Library/DxeNetLib/DxeNetLib.c')
-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++;
}