From 137d1a3ac168cf57f9b2b2487372d053548d37e6 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 9 Sep 2021 19:35:17 +0300 Subject: [PATCH] examples: additional check for IPv6 completeness See neo-project/non-native-contracts#4. --- examples/nft-nd-nns/nns.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/nft-nd-nns/nns.go b/examples/nft-nd-nns/nns.go index fb21e1c1d..4b8d7bb96 100644 --- a/examples/nft-nd-nns/nns.go +++ b/examples/nft-nd-nns/nns.go @@ -613,6 +613,9 @@ func checkIPv6(data string) bool { nums[idx] = n } } + if l < 8 && !hasEmpty { + return false + } f0 := nums[0] if f0 < 0x2000 || f0 == 0x2002 || f0 == 0x3ffe || f0 > 0x3fff { // IPv6 Global Unicast https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml