mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
check option and packet length
This commit is contained in:
parent
11328a429d
commit
09dbe9fc03
|
@ -297,6 +297,11 @@ namespace stream
|
||||||
{
|
{
|
||||||
const uint8_t * optionData = packet->GetOptionData ();
|
const uint8_t * optionData = packet->GetOptionData ();
|
||||||
size_t optionSize = packet->GetOptionSize ();
|
size_t optionSize = packet->GetOptionSize ();
|
||||||
|
if (optionSize > packet->len)
|
||||||
|
{
|
||||||
|
LogPrint (eLogInfo, "Streaming: Invalid option size ", optionSize, " Discarded");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (flags & PACKET_FLAG_DELAY_REQUESTED)
|
if (flags & PACKET_FLAG_DELAY_REQUESTED)
|
||||||
{
|
{
|
||||||
if (!m_IsAckSendScheduled)
|
if (!m_IsAckSendScheduled)
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace stream
|
||||||
|
|
||||||
Packet (): len (0), offset (0), sendTime (0), resent (false) {};
|
Packet (): len (0), offset (0), sendTime (0), resent (false) {};
|
||||||
uint8_t * GetBuffer () { return buf + offset; };
|
uint8_t * GetBuffer () { return buf + offset; };
|
||||||
size_t GetLength () const { return len - offset; };
|
size_t GetLength () const { return len > offset ? len - offset : 0; };
|
||||||
|
|
||||||
uint32_t GetSendStreamID () const { return bufbe32toh (buf); };
|
uint32_t GetSendStreamID () const { return bufbe32toh (buf); };
|
||||||
uint32_t GetReceiveStreamID () const { return bufbe32toh (buf + 4); };
|
uint32_t GetReceiveStreamID () const { return bufbe32toh (buf + 4); };
|
||||||
|
|
Loading…
Reference in a new issue