fix zone validator

(bug caught by fuzzer)
This commit is contained in:
Steven Allen 2018-10-18 10:35:11 +01:00
parent 877fe6538c
commit faf8963c9a

View File

@ -73,6 +73,9 @@ func ip6zoneBtS(b []byte) (string, error) {
}
func ip6zoneVal(b []byte) error {
if len(b) == 0 {
return fmt.Errorf("invalid length (should be > 0)")
}
// Not supported as this would break multiaddrs.
if bytes.IndexByte(b, '/') >= 0 {
return fmt.Errorf("IPv6 zone ID contains '/': %s", string(b))