mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-13 04:46:38 +01:00
delete trailing paddings of SSU packtes
This commit is contained in:
parent
00ac1f7ec9
commit
92bd29ebf1
1 changed files with 2 additions and 0 deletions
|
@ -126,6 +126,8 @@ namespace transport
|
||||||
|
|
||||||
void SSUSession::ProcessMessage (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint)
|
void SSUSession::ProcessMessage (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint)
|
||||||
{
|
{
|
||||||
|
len -= (len & 0x0F); // %16, delete extra padding
|
||||||
|
if (len <= sizeof (SSUHeader)) return; // drop empty message
|
||||||
//TODO: since we are accessing a uint8_t this is unlikely to crash due to alignment but should be improved
|
//TODO: since we are accessing a uint8_t this is unlikely to crash due to alignment but should be improved
|
||||||
SSUHeader * header = (SSUHeader *)buf;
|
SSUHeader * header = (SSUHeader *)buf;
|
||||||
switch (header->GetPayloadType ())
|
switch (header->GetPayloadType ())
|
||||||
|
|
Loading…
Add table
Reference in a new issue