From 7ed87433d80e6d894d20ddd65b4266f9ec2e0f23 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 16 Jan 2024 09:45:51 +0100 Subject: [PATCH] chore: add missing outgoing message check (#6082) --- crates/net/eth-wire/src/p2pstream.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/net/eth-wire/src/p2pstream.rs b/crates/net/eth-wire/src/p2pstream.rs index d46ece6836..6c68369ed5 100644 --- a/crates/net/eth-wire/src/p2pstream.rs +++ b/crates/net/eth-wire/src/p2pstream.rs @@ -556,6 +556,13 @@ where } fn start_send(self: Pin<&mut Self>, item: Bytes) -> Result<(), Self::Error> { + if item.len() > MAX_PAYLOAD_SIZE { + return Err(P2PStreamError::MessageTooBig { + message_size: item.len(), + max_size: MAX_PAYLOAD_SIZE, + }) + } + // ensure we have free capacity if !self.has_outgoing_capacity() { return Err(P2PStreamError::SendBufferFull)