From bc4cda8ea72d655d8c4487fb59e50cf0ad4b8ef8 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 8 Jun 2021 13:27:15 +0200 Subject: [PATCH] mdns: Fix fuzzer from miss-interpreting adding services as timeouts * Original commit: espressif/esp-idf@14099fe15efb1b0cde0a8370096c55bba62ff937 --- components/mdns/test_afl_fuzz_host/esp32_mock.c | 8 ++------ components/mdns/test_afl_fuzz_host/sdkconfig.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/components/mdns/test_afl_fuzz_host/esp32_mock.c b/components/mdns/test_afl_fuzz_host/esp32_mock.c index 0a01514ff..d806093fc 100644 --- a/components/mdns/test_afl_fuzz_host/esp32_mock.c +++ b/components/mdns/test_afl_fuzz_host/esp32_mock.c @@ -48,12 +48,8 @@ esp_err_t esp_timer_create(const esp_timer_create_args_t* create_args, uint32_t xTaskGetTickCount(void) { - struct timeval tv; - struct timezone tz; - if (gettimeofday(&tv, &tz) == 0) { - return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); - } - return 0; + static uint32_t tick = 0; + return tick++; } /// Queue mock diff --git a/components/mdns/test_afl_fuzz_host/sdkconfig.h b/components/mdns/test_afl_fuzz_host/sdkconfig.h index 43d4a278a..1b5997b64 100644 --- a/components/mdns/test_afl_fuzz_host/sdkconfig.h +++ b/components/mdns/test_afl_fuzz_host/sdkconfig.h @@ -294,7 +294,7 @@ #define CONFIG_MDNS_TASK_STACK_SIZE 4096 #define CONFIG_MDNS_TASK_AFFINITY_CPU0 1 #define CONFIG_MDNS_TASK_AFFINITY 0x0 -#define CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS 100 +#define CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS 1 #define CONFIG_MDNS_TIMER_PERIOD_MS 100 #define CONFIG_MQTT_PROTOCOL_311 1 #define CONFIG_MQTT_TRANSPORT_SSL 1