Commit c09af663 authored by Quan Yong Zhai's avatar Quan Yong Zhai Committed by Russ Cox

net: fix ParseIP

Fixes #1695.

R=golang-dev, rsc
CC=golang-dev, r
https://golang.org/cl/4418042
parent 24bb0340
......@@ -436,7 +436,7 @@ func parseIPv6(s string) IP {
}
// Otherwise must be followed by colon and more.
if s[i] != ':' && i+1 == len(s) {
if s[i] != ':' || i+1 == len(s) {
return nil
}
i++
......
......@@ -29,6 +29,7 @@ var parseiptests = []struct {
{"127.0.0.1", IPv4(127, 0, 0, 1)},
{"127.0.0.256", nil},
{"abc", nil},
{"123:", nil},
{"::ffff:127.0.0.1", IPv4(127, 0, 0, 1)},
{"2001:4860:0:2001::68",
IP{0x20, 0x01, 0x48, 0x60, 0, 0, 0x20, 0x01,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment