mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-21 16:49:10 +01:00
check garlic clove length
This commit is contained in:
parent
7ec701a816
commit
969695f318
1 changed files with 6 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue