From 1b49cf373f1b4a426fd8d4e96a0f289e5e1e948b Mon Sep 17 00:00:00 2001 From: David Cermak Date: Wed, 2 Feb 2022 17:30:20 +0100 Subject: [PATCH] lwip/dhcps: Fix fuzzer compilation --- components/lwip/apps/dhcpserver/dhcpserver.c | 3 +-- components/lwip/test_afl_host/network_mock.c | 5 +++++ components/lwip/test_afl_host/test_dhcp_server.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/components/lwip/apps/dhcpserver/dhcpserver.c b/components/lwip/apps/dhcpserver/dhcpserver.c index 9ed3a011d9..e3db845d3f 100644 --- a/components/lwip/apps/dhcpserver/dhcpserver.c +++ b/components/lwip/apps/dhcpserver/dhcpserver.c @@ -6,8 +6,7 @@ //#include "esp_common.h" #include #include -#include -#include "lwip/inet.h" +#include "lwip/dhcp.h" #include "lwip/err.h" #include "lwip/pbuf.h" #include "lwip/udp.h" diff --git a/components/lwip/test_afl_host/network_mock.c b/components/lwip/test_afl_host/network_mock.c index 5daca4cb8d..7b77197c92 100644 --- a/components/lwip/test_afl_host/network_mock.c +++ b/components/lwip/test_afl_host/network_mock.c @@ -229,6 +229,11 @@ void * mem_malloc(mem_size_t size) return malloc(size); } +void * mem_calloc(size_t nr, mem_size_t size) +{ + return calloc(nr, size); +} + void mem_free(void *rmem) { free(rmem); diff --git a/components/lwip/test_afl_host/test_dhcp_server.c b/components/lwip/test_afl_host/test_dhcp_server.c index e788310d46..54084ee55a 100644 --- a/components/lwip/test_afl_host/test_dhcp_server.c +++ b/components/lwip/test_afl_host/test_dhcp_server.c @@ -10,7 +10,7 @@ ip4_addr_t server_ip; struct netif mynetif; // dhcps callback -void dhcp_test_dhcps_cb (u8_t client_ip[4]) {} +void dhcp_test_dhcps_cb (void* cb_arg, u8_t client_ip[4], u8_t client_mac[6]) {} // Dependency injected static function to pass the packet into parser void dhcp_test_handle_dhcp(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port); @@ -30,7 +30,7 @@ int main(int argc, char** argv) IP4_ADDR(&server_ip, 192,168,4,1); dhcps_t *dhcps = dhcps_new(); - dhcps_set_new_lease_cb(dhcps, dhcp_test_dhcps_cb); + dhcps_set_new_lease_cb(dhcps, dhcp_test_dhcps_cb, NULL); dhcps_start(dhcps, &mynetif, server_ip); #ifdef INSTR_IS_OFF