fix: validate empty item in p2p start_send (#7294)

This commit is contained in:
Nil Medvedev
2024-03-22 17:09:29 +00:00
committed by GitHub
parent 30d79a98aa
commit f96d790661

View File

@ -581,6 +581,11 @@ where
})
}
if item.is_empty() {
// empty messages are not allowed
return Err(P2PStreamError::EmptyProtocolMessage)
}
// ensure we have free capacity
if !self.has_outgoing_capacity() {
return Err(P2PStreamError::SendBufferFull)