cmd/rlpdump, cmd/utils, eth, p2p, whisper: use rlp input limit
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user