core: check for key length in CheckWitness, fix #968
Only one type of keys is allowed here.
This commit is contained in:
parent
d0853c0471
commit
0ce3a12e87
1 changed files with 4 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue