inetaf / netaddr

Network address types

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ParseIPPrefix confused by zones that contain "/"

josharian opened this issue · comments

Fuzzing finds the most hilarious things.

ip, err := ParseIP("::%0/00")
// ip: "::%0/00"
// err: nil
ipp := IPPrefixFrom(ip, 80)
s := ipp.String()
// s: "::%0/00/80"
ipp2, err := ParseIPPrefix(s)
// err: "netaddr.ParseIPPrefix("00/80"): bad prefix: strconv.Atoi: parsing "00/80": invalid syntax"

Technically, ::%0/00/80 is a perfectly acceptable IPPrefix that we currently reject.