diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-19 23:07:59 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-19 23:07:59 +0800 |
commit | 8eff550e8b9bf121c27a4c2469ec9878d803a60e (patch) | |
tree | ddc62daeec7a44c2baacb986f8c9d76df25a5976 /p2p/message.go | |
parent | 4683f9c0a71fd42e749da46ac56c6ba76f379931 (diff) | |
parent | 8f3a7e41deff4084b166aca1337258077bd2a3e6 (diff) | |
download | dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.gz dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.bz2 dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.lz dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.xz dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.zst dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.zip |
Merge branch 'fjl-rlp-size-validation' into develop
Diffstat (limited to 'p2p/message.go')
-rw-r--r-- | p2p/message.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/p2p/message.go b/p2p/message.go index b42acbe3c..be6405d6f 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -32,7 +32,8 @@ type Msg struct { // // For the decoding rules, please see package rlp. func (msg Msg) Decode(val interface{}) error { - if err := rlp.Decode(msg.Payload, val); err != nil { + s := rlp.NewStream(msg.Payload, uint64(msg.Size)) + if err := s.Decode(val); err != nil { return newPeerError(errInvalidMsg, "(code %x) (size %d) %v", msg.Code, msg.Size, err) } return nil |