mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
check garlic clove length
This commit is contained in:
parent
7ec701a816
commit
969695f318
@ -461,6 +461,7 @@ namespace garlic
|
|||||||
|
|
||||||
void GarlicDestination::HandleGarlicPayload (uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from)
|
void GarlicDestination::HandleGarlicPayload (uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from)
|
||||||
{
|
{
|
||||||
|
const uint8_t * buf1 = buf;
|
||||||
int numCloves = buf[0];
|
int numCloves = buf[0];
|
||||||
LogPrint (numCloves," cloves");
|
LogPrint (numCloves," cloves");
|
||||||
buf++;
|
buf++;
|
||||||
@ -518,6 +519,11 @@ namespace garlic
|
|||||||
buf += 4; // CloveID
|
buf += 4; // CloveID
|
||||||
buf += 8; // Date
|
buf += 8; // Date
|
||||||
buf += 3; // Certificate
|
buf += 3; // Certificate
|
||||||
|
if (buf - buf1 > (int)len)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Gralic clove is too long");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user