From faf8963c9ac74a263cc4e6fa1631425d7bb1cad9 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 18 Oct 2018 10:35:11 +0100 Subject: [PATCH] fix zone validator (bug caught by fuzzer) --- transcoders.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/transcoders.go b/transcoders.go index 86ce200..b5408f0 100644 --- a/transcoders.go +++ b/transcoders.go @@ -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))