From 0ce3a12e87c639d32d730405c30a5225dddeaea1 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 21 May 2020 14:27:19 +0300 Subject: [PATCH] core: check for key length in CheckWitness, fix #968 Only one type of keys is allowed here. --- pkg/core/interop_system.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/core/interop_system.go b/pkg/core/interop_system.go index 9f8b4fc14..bfa669bda 100644 --- a/pkg/core/interop_system.go +++ b/pkg/core/interop_system.go @@ -322,6 +322,10 @@ func (ic *interopContext) runtimeCheckWitness(v *vm.VM) error { hashOrKey := v.Estack().Pop().Bytes() hash, err := util.Uint160DecodeBytesBE(hashOrKey) if err != nil { + // We only accept compressed keys here as per C# implementation. + if len(hashOrKey) != 33 { + return errors.New("bad parameter length") + } key := &keys.PublicKey{} err = key.DecodeBytes(hashOrKey) if err != nil {