p2p/rlpx: 2KB maximum size for handshake messages (#30029)

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
David Theodore 2024-06-20 07:08:54 -05:00 committed by GitHub
parent 00675c5876
commit 27654d3022
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -604,6 +604,11 @@ func (h *handshakeState) readMsg(msg interface{}, prv *ecdsa.PrivateKey, r io.Re
}
size := binary.BigEndian.Uint16(prefix)
// baseProtocolMaxMsgSize = 2 * 1024
if size > 2048 {
return nil, errors.New("message too big")
}
// Read the handshake packet.
packet, err := h.rbuf.read(r, int(size))
if err != nil {