mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
strict check of bounds
This commit is contained in:
parent
dd9c8c91a3
commit
8c84eac718
@ -716,8 +716,10 @@ namespace llarp
|
||||
void
|
||||
Session::HandleXMIT(Packet_t data)
|
||||
{
|
||||
if(data.size() < (CommandOverhead + PacketOverhead + sizeof(uint16_t)
|
||||
+ sizeof(uint64_t) + ShortHash::SIZE))
|
||||
static constexpr size_t XMITOverhead =
|
||||
(CommandOverhead + PacketOverhead + sizeof(uint16_t)
|
||||
+ sizeof(uint64_t) + ShortHash::SIZE);
|
||||
if(data.size() < XMITOverhead)
|
||||
{
|
||||
LogError("short XMIT from ", m_RemoteAddr);
|
||||
return;
|
||||
@ -750,7 +752,7 @@ namespace llarp
|
||||
InboundMessage{rxid, sz, std::move(h), m_Parent->Now()})
|
||||
.first;
|
||||
sz = std::min(sz, uint16_t{FragmentSize});
|
||||
if(data.size() > sz)
|
||||
if((data.size() - XMITOverhead) == sz)
|
||||
{
|
||||
{
|
||||
const llarp_buffer_t buf(data.data() + (data.size() - sz), sz);
|
||||
|
Loading…
Reference in New Issue
Block a user