net/ipv6: Drop IP packet shorter than length in IP header

If the length of received ip packet is shorter than length in ip header, drop it.

Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
This commit is contained in:
wenquan1
2025-07-24 11:09:12 +08:00
committed by Xiang Xiao
parent 6d916a4b0a
commit 424a924f65
+2
View File
@@ -224,6 +224,8 @@ static int ipv6_in(FAR struct net_driver_s *dev)
/* Get the size of the packet minus the size of link layer header */
dev->d_len -= NET_LL_HDRLEN(dev);
if (IPv6_HDRLEN > dev->d_len)
{
nwarn("WARNING: Packet shorter than IPv6 header\n");