From 6ee313e6db298c8161e843b5ab1566f41584d6f0 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Thu, 11 Sep 2014 10:45:20 -0700 Subject: [PATCH] do not accept invalid-start multiaddrs --- codec.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codec.go b/codec.go index ca0400a..64ef240 100644 --- a/codec.go +++ b/codec.go @@ -12,6 +12,10 @@ func StringToBytes(s string) ([]byte, error) { b := []byte{} sp := strings.Split(s, "/") + if sp[0] != "" { + return nil, fmt.Errorf("invalid multiaddr, must begin with /") + } + // consume first empty elem sp = sp[1:]