bugfix: calculate L2TPv2 offset
This commit is contained in:
@@ -728,7 +728,21 @@ static inline uint16_t get_l2tpv2_hdr_len(const char *data, uint16_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ntohs(*((uint16_t *)(data + skip_len)));
|
||||
uint16_t offset = ntohs(*((uint16_t *)(data + skip_len)));
|
||||
if (offset == 0)
|
||||
{
|
||||
return skip_len + 2;
|
||||
}
|
||||
|
||||
// invalid offset
|
||||
if (offset > len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user