test/fuzz: Don't crash with assertion failure when a packet is too big

A fuzzer may generate big packets, and it will interpret assertion
failures as bugs. Instead of asserting that the packet size is
reasonable, simply skip the packet when it's not the case.
This commit is contained in:
Jonathan Neuschäfer 2023-04-06 15:58:46 +02:00 committed by Simon Goldschmidt
parent 0f2de1f684
commit e8b0324f81

View File

@ -192,7 +192,11 @@ static void input_pkt(struct netif *netif, const u8_t *data, size_t len)
struct pbuf *p, *q;
err_t err;
LWIP_ASSERT("pkt too big", len <= 0xFFFF);
if (len > 0xFFFF) {
printf("pkt too big (%#zX bytes)\n", len);
return;
}
p = pbuf_alloc(PBUF_RAW, (u16_t)len, PBUF_POOL);
LWIP_ASSERT("alloc failed", p);
for(q = p; q != NULL; q = q->next) {