p2p/rlpx: 2KB maximum size for handshake messages (#30029)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
00675c5876
commit
27654d3022
@ -604,6 +604,11 @@ func (h *handshakeState) readMsg(msg interface{}, prv *ecdsa.PrivateKey, r io.Re
|
|||||||
}
|
}
|
||||||
size := binary.BigEndian.Uint16(prefix)
|
size := binary.BigEndian.Uint16(prefix)
|
||||||
|
|
||||||
|
// baseProtocolMaxMsgSize = 2 * 1024
|
||||||
|
if size > 2048 {
|
||||||
|
return nil, errors.New("message too big")
|
||||||
|
}
|
||||||
|
|
||||||
// Read the handshake packet.
|
// Read the handshake packet.
|
||||||
packet, err := h.rbuf.read(r, int(size))
|
packet, err := h.rbuf.read(r, int(size))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user