mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-19 05:19:57 +00:00
drop too long or too short LeaseSet
This commit is contained in:
parent
2a6883e305
commit
fafdb0c590
@ -399,6 +399,11 @@ namespace client
|
|||||||
|
|
||||||
void LeaseSetDestination::HandleDatabaseStoreMessage (const uint8_t * buf, size_t len)
|
void LeaseSetDestination::HandleDatabaseStoreMessage (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
|
if (len < DATABASE_STORE_HEADER_SIZE)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Destination: Database store msg is too short ", len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint32_t replyToken = bufbe32toh (buf + DATABASE_STORE_REPLY_TOKEN_OFFSET);
|
uint32_t replyToken = bufbe32toh (buf + DATABASE_STORE_REPLY_TOKEN_OFFSET);
|
||||||
size_t offset = DATABASE_STORE_HEADER_SIZE;
|
size_t offset = DATABASE_STORE_HEADER_SIZE;
|
||||||
if (replyToken)
|
if (replyToken)
|
||||||
@ -406,6 +411,11 @@ namespace client
|
|||||||
LogPrint (eLogInfo, "Destination: Reply token is ignored for DatabaseStore");
|
LogPrint (eLogInfo, "Destination: Reply token is ignored for DatabaseStore");
|
||||||
offset += 36;
|
offset += 36;
|
||||||
}
|
}
|
||||||
|
if (offset > len || len > i2p::data::MAX_LS_BUFFER_SIZE + offset)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Destination: Database store message is too long ", len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
i2p::data::IdentHash key (buf + DATABASE_STORE_KEY_OFFSET);
|
i2p::data::IdentHash key (buf + DATABASE_STORE_KEY_OFFSET);
|
||||||
std::shared_ptr<i2p::data::LeaseSet> leaseSet;
|
std::shared_ptr<i2p::data::LeaseSet> leaseSet;
|
||||||
switch (buf[DATABASE_STORE_TYPE_OFFSET])
|
switch (buf[DATABASE_STORE_TYPE_OFFSET])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user