limit mininal received packet size to 40 bytes

This commit is contained in:
orignal 2024-01-19 14:09:48 -05:00
parent b4484c8e8f
commit 140146e433
2 changed files with 10 additions and 2 deletions

View file

@ -283,8 +283,15 @@ namespace transport
// but better to find out which host were sent it and mark that router as unreachable
{
i2p::transport::transports.UpdateReceivedBytes (bytes_transferred);
if (bytes_transferred < SSU2_MIN_RECEIVED_PACKET_SIZE)
{
// drop too short packets
m_PacketsPool.ReleaseMt (packet);
Receive (socket);
return;
}
packet->len = bytes_transferred;
boost::system::error_code ec;
size_t moreBytes = socket.available (ec);
if (!ec && moreBytes)