bugfix: calculate L2TPv2 offset

This commit is contained in:
luwenpeng
2024-05-30 18:45:39 +08:00
parent 1a7f74025b
commit 2d958dbe07
3 changed files with 32 additions and 29 deletions

View File

@@ -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
{