Skip to content

Commit 353818f

Browse files
authored
v1.0-cherrypick: ESP32: Drop Invalid RA packets (#33060) (#33101)
1 parent 9bd53e8 commit 353818f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/platform/esp32/route_hook/esp_route_hook.c

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ static void ra_recv_handler(struct netif * netif, const uint8_t * icmp_payload,
7676
{
7777
uint8_t opt_type = icmp_payload[0];
7878
uint8_t opt_len = icmp_payload[1] << 3;
79+
if (opt_len == 0 || opt_len > payload_len)
80+
{
81+
ESP_LOGE(TAG, "Invalid ND6 option length");
82+
break;
83+
}
7984

8085
if (opt_type == ND6_OPTION_TYPE_ROUTE_INFO && opt_len >= sizeof(rio_header_t) && !is_self_address(netif, src_addr) &&
8186
payload_len >= opt_len)

0 commit comments

Comments
 (0)