Skip to content

Commit

Permalink
Merge pull request #2079 from CortexFoundation/dev
Browse files Browse the repository at this point in the history
p2p/rlpx: 2KB maximum size for handshake messages
  • Loading branch information
ucwong committed Jun 27, 2024
2 parents 8c81a48 + 20b3d34 commit 86acc37
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 any, prv *ecdsa.PrivateKey, r io.Reader) ([
}
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 86acc37

Please sign in to comment.