nft-nd-nns: more checks for IPv6

neo-project/non-native-contracts#7
This commit is contained in:
Roman Khimov 2021-09-10 11:30:27 +03:00
parent aaccf748ac
commit 15e8fc08ce

View file

@ -617,8 +617,14 @@ func checkIPv6(data string) bool {
for i, f := range fragments { for i, f := range fragments {
if len(f) == 0 { if len(f) == 0 {
if i == 0 { if i == 0 {
if len(fragments[1]) != 0 {
return false
}
nums[i] = 0 nums[i] = 0
} else if i == l-1 { } else if i == l-1 {
if len(fragments[i-1]) != 0 {
return false
}
nums[7] = 0 nums[7] = 0
} else if hasEmpty { } else if hasEmpty {
return false return false