mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
check message length
This commit is contained in:
parent
fe9ac10f02
commit
744e893dce
@ -246,8 +246,16 @@ namespace client
|
|||||||
m_PayloadLen = bufbe32toh (m_Header + I2CP_HEADER_LENGTH_OFFSET);
|
m_PayloadLen = bufbe32toh (m_Header + I2CP_HEADER_LENGTH_OFFSET);
|
||||||
if (m_PayloadLen > 0)
|
if (m_PayloadLen > 0)
|
||||||
{
|
{
|
||||||
m_Payload = new uint8_t[m_PayloadLen];
|
if (m_PayloadLen <= I2CP_MAX_MESSAGE_LENGTH)
|
||||||
ReceivePayload ();
|
{
|
||||||
|
m_Payload = new uint8_t[m_PayloadLen];
|
||||||
|
ReceivePayload ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "I2CP: Unexpected payload length ", m_PayloadLen);
|
||||||
|
Terminate ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // no following payload
|
else // no following payload
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,8 @@ namespace client
|
|||||||
{
|
{
|
||||||
const uint8_t I2CP_PROTOCOL_BYTE = 0x2A;
|
const uint8_t I2CP_PROTOCOL_BYTE = 0x2A;
|
||||||
const size_t I2CP_SESSION_BUFFER_SIZE = 4096;
|
const size_t I2CP_SESSION_BUFFER_SIZE = 4096;
|
||||||
|
const size_t I2CP_MAX_MESSAGE_LENGTH = 65535;
|
||||||
|
|
||||||
const size_t I2CP_HEADER_LENGTH_OFFSET = 0;
|
const size_t I2CP_HEADER_LENGTH_OFFSET = 0;
|
||||||
const size_t I2CP_HEADER_TYPE_OFFSET = I2CP_HEADER_LENGTH_OFFSET + 4;
|
const size_t I2CP_HEADER_TYPE_OFFSET = I2CP_HEADER_LENGTH_OFFSET + 4;
|
||||||
const size_t I2CP_HEADER_SIZE = I2CP_HEADER_TYPE_OFFSET + 1;
|
const size_t I2CP_HEADER_SIZE = I2CP_HEADER_TYPE_OFFSET + 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user