mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 04:44:13 +00:00
correct buffer size for deflate
This commit is contained in:
parent
ff48422ec0
commit
9cc592b564
@ -764,6 +764,7 @@ namespace stream
|
|||||||
m_LocalDestination.m_Deflator.SetCompressionLevel (Z_DEFAULT_COMPRESSION);
|
m_LocalDestination.m_Deflator.SetCompressionLevel (Z_DEFAULT_COMPRESSION);
|
||||||
uint8_t * buf = msg->GetPayload ();
|
uint8_t * buf = msg->GetPayload ();
|
||||||
buf += 4; // reserve for lengthlength
|
buf += 4; // reserve for lengthlength
|
||||||
|
msg->len += 4;
|
||||||
size_t size = m_LocalDestination.m_Deflator.Deflate (payload, len, buf, msg->maxLen - msg->len);
|
size_t size = m_LocalDestination.m_Deflator.Deflate (payload, len, buf, msg->maxLen - msg->len);
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
@ -771,7 +772,7 @@ namespace stream
|
|||||||
htobe16buf (buf + 4, m_LocalDestination.GetLocalPort ()); // source port
|
htobe16buf (buf + 4, m_LocalDestination.GetLocalPort ()); // source port
|
||||||
htobe16buf (buf + 6, m_Port); // destination port
|
htobe16buf (buf + 6, m_Port); // destination port
|
||||||
buf[9] = i2p::client::PROTOCOL_TYPE_STREAMING; // streaming protocol
|
buf[9] = i2p::client::PROTOCOL_TYPE_STREAMING; // streaming protocol
|
||||||
msg->len += size + 4;
|
msg->len += size;
|
||||||
msg->FillI2NPMessageHeader (eI2NPData);
|
msg->FillI2NPMessageHeader (eI2NPData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user