Skip to content

Commit d9e9740

Browse files
committed
v1.1-cherry-pick:ESP32: Drop Invalid RA packets (project-chip#33060)
1 parent 319a8b5 commit d9e9740

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/platform/ESP32/route_hook/ESP32RouteHook.c

+5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ static void ra_recv_handler(struct netif * netif, const uint8_t * icmp_payload,
6565
{
6666
uint8_t opt_type = icmp_payload[0];
6767
uint8_t opt_len = (uint8_t)(icmp_payload[1] << 3);
68+
if (opt_len == 0 || opt_len > payload_len)
69+
{
70+
ESP_LOGE(TAG, "Invalid ND6 option length");
71+
break;
72+
}
6873

6974
if (opt_type == ND6_OPTION_TYPE_ROUTE_INFO && opt_len >= sizeof(route_option_t) - sizeof(ip6_addr_p_t) &&
7075
!is_self_address(netif, src_addr) && payload_len >= opt_len)

0 commit comments

Comments
 (0)