mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-07 07:44:13 +00:00
check if number of peers to exclude doesn't exceed 512
This commit is contained in:
parent
6b596bd05f
commit
ad211a63f3
@ -166,7 +166,7 @@ namespace i2p
|
|||||||
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel, const uint8_t * replyKey, const uint8_t * replyTag)
|
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel, const uint8_t * replyKey, const uint8_t * replyTag)
|
||||||
{
|
{
|
||||||
int cnt = excludedFloodfills.size ();
|
int cnt = excludedFloodfills.size ();
|
||||||
auto m = cnt > 0 ? NewI2NPMessage () : NewI2NPShortMessage ();
|
auto m = cnt > 7 ? NewI2NPMessage () : NewI2NPShortMessage ();
|
||||||
uint8_t * buf = m->GetPayload ();
|
uint8_t * buf = m->GetPayload ();
|
||||||
memcpy (buf, dest, 32); // key
|
memcpy (buf, dest, 32); // key
|
||||||
buf += 32;
|
buf += 32;
|
||||||
@ -178,6 +178,11 @@ namespace i2p
|
|||||||
buf += 4;
|
buf += 4;
|
||||||
|
|
||||||
// excluded
|
// excluded
|
||||||
|
if (cnt > 512)
|
||||||
|
{
|
||||||
|
LogPrint (eLogWarning, "I2NP: Too many peers to exclude ", cnt, " for DatabaseLookup");
|
||||||
|
cnt = 0;
|
||||||
|
}
|
||||||
htobe16buf (buf, cnt);
|
htobe16buf (buf, cnt);
|
||||||
buf += 2;
|
buf += 2;
|
||||||
if (cnt > 0)
|
if (cnt > 0)
|
||||||
@ -190,7 +195,7 @@ namespace i2p
|
|||||||
}
|
}
|
||||||
// encryption
|
// encryption
|
||||||
memcpy (buf, replyKey, 32);
|
memcpy (buf, replyKey, 32);
|
||||||
buf[32] = uint8_t( 1 ); // 1 tag
|
buf[32] = 1; // 1 tag
|
||||||
memcpy (buf + 33, replyTag, 32);
|
memcpy (buf + 33, replyTag, 32);
|
||||||
buf += 65;
|
buf += 65;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user