From c5ceb9128a6b3aa12c6d59a1d936af74e4e665bc Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 25 Dec 2019 15:50:52 +0300 Subject: [PATCH] address: check for prefix when decoding --- pkg/encoding/address/address.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/encoding/address/address.go b/pkg/encoding/address/address.go index 62e9404bc..02548d100 100644 --- a/pkg/encoding/address/address.go +++ b/pkg/encoding/address/address.go @@ -1,6 +1,8 @@ package address import ( + "errors" + "github.com/CityOfZion/neo-go/pkg/encoding/base58" "github.com/CityOfZion/neo-go/pkg/util" ) @@ -23,5 +25,8 @@ func DecodeUint160(s string) (u util.Uint160, err error) { if err != nil { return u, err } + if b[0] != Prefix { + return u, errors.New("wrong address prefix") + } return util.Uint160DecodeBytesBE(b[1:21]) }