forked from TrueCloudLab/neoneo-go
nef: limit the number of bytes to be read during decode
This commit is contained in:
parent
63c7469dfd
commit
f45c032eff
1 changed files with 1 additions and 5 deletions
|
@ -203,11 +203,7 @@ func (n *File) DecodeBinary(r *io.BinReader) {
|
||||||
r.Err = errors.New("CRC verification fail")
|
r.Err = errors.New("CRC verification fail")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
n.Script = r.ReadVarBytes()
|
n.Script = r.ReadVarBytes(MaxScriptLength)
|
||||||
if len(n.Script) > MaxScriptLength {
|
|
||||||
r.Err = errors.New("invalid script length")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !hash.Hash160(n.Script).Equals(n.Header.ScriptHash) {
|
if !hash.Hash160(n.Script).Equals(n.Header.ScriptHash) {
|
||||||
r.Err = errors.New("script hashes mismatch")
|
r.Err = errors.New("script hashes mismatch")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue