p2p: set RecvMessageCapacity to maxMsgSize in all reactors

to prevent malicious nodes from sending us large messages (~21MB, which
is the default `RecvMessageCapacity`)

This allows us to remove unnecessary `maxMsgSize` check in `decodeMsg`. Since each channel has a msg capacity set to `maxMsgSize`, there's no need to check it again in `decodeMsg`.

Closes #1503
This commit is contained in:
Anton Kaliaev
2020-04-28 14:05:09 +04:00
committed by GitHub
parent f31f4327b5
commit 8f463cf35c
7 changed files with 9 additions and 27 deletions

View File

@@ -394,9 +394,6 @@ func RegisterBlockchainMessages(cdc *amino.Codec) {
}
func decodeMsg(bz []byte) (msg BlockchainMessage, err error) {
if len(bz) > maxMsgSize {
return msg, fmt.Errorf("msg exceeds max size (%d > %d)", len(bz), maxMsgSize)
}
err = cdc.UnmarshalBinaryBare(bz, &msg)
return
}