mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-10 19:38:28 +01:00
Added bounds checking to LeaseSet2.
This commit is contained in:
parent
13f263b791
commit
9ae8c1869a
1 changed files with 8 additions and 0 deletions
|
@ -394,6 +394,10 @@ namespace data
|
||||||
size_t LeaseSet2::ReadStandardLS2TypeSpecificPart (const uint8_t * buf, size_t len)
|
size_t LeaseSet2::ReadStandardLS2TypeSpecificPart (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
|
|
||||||
|
if(offset + 2 > len) // AKA (len < 2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
// properties
|
// properties
|
||||||
uint16_t propertiesLen = bufbe16toh (buf + offset); offset += 2;
|
uint16_t propertiesLen = bufbe16toh (buf + offset); offset += 2;
|
||||||
offset += propertiesLen; // skip for now. TODO: implement properties
|
offset += propertiesLen; // skip for now. TODO: implement properties
|
||||||
|
@ -448,6 +452,10 @@ namespace data
|
||||||
size_t LeaseSet2::ReadMetaLS2TypeSpecificPart (const uint8_t * buf, size_t len)
|
size_t LeaseSet2::ReadMetaLS2TypeSpecificPart (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
|
|
||||||
|
if(offset + 2 > len) // AKA (len < 2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
// properties
|
// properties
|
||||||
uint16_t propertiesLen = bufbe16toh (buf + offset); offset += 2;
|
uint16_t propertiesLen = bufbe16toh (buf + offset); offset += 2;
|
||||||
offset += propertiesLen; // skip for now. TODO: implement properties
|
offset += propertiesLen; // skip for now. TODO: implement properties
|
||||||
|
|
Loading…
Add table
Reference in a new issue