mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-07 15:33:08 +00:00
do not accept invalid-start multiaddrs
This commit is contained in:
parent
99196c0d23
commit
6ee313e6db
4
codec.go
4
codec.go
@ -12,6 +12,10 @@ func StringToBytes(s string) ([]byte, error) {
|
|||||||
b := []byte{}
|
b := []byte{}
|
||||||
sp := strings.Split(s, "/")
|
sp := strings.Split(s, "/")
|
||||||
|
|
||||||
|
if sp[0] != "" {
|
||||||
|
return nil, fmt.Errorf("invalid multiaddr, must begin with /")
|
||||||
|
}
|
||||||
|
|
||||||
// consume first empty elem
|
// consume first empty elem
|
||||||
sp = sp[1:]
|
sp = sp[1:]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user