Skip to content

Commit

Permalink
p2p/rlpx: 2KB maximum size for handshake messages (#30029)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
infosecual and fjl authored Jun 20, 2024
1 parent 00675c5 commit 27654d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions p2p/rlpx/rlpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 27654d3

Please sign in to comment.