Browse Source

check garlic clove length

pull/189/head
orignal 10 years ago
parent
commit
969695f318
  1. 6
      Garlic.cpp

6
Garlic.cpp

@ -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…
Cancel
Save