diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-23 22:08:29 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-04-17 20:45:09 +0800 |
commit | 56a48101dc3dd96587915a5d7882f9d46ecc6ae9 (patch) | |
tree | 575920d621c24815f0b197f46ab32cba2735b99b /p2p/message.go | |
parent | c35f4fd0bd93bcab01ba7704fc144514a2cc7a1b (diff) | |
download | dexon-56a48101dc3dd96587915a5d7882f9d46ecc6ae9.tar.gz dexon-56a48101dc3dd96587915a5d7882f9d46ecc6ae9.tar.zst dexon-56a48101dc3dd96587915a5d7882f9d46ecc6ae9.zip |
cmd/rlpdump, cmd/utils, eth, p2p, whisper: use rlp input limit
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 |