From 4e088964efa8128ee8eaed46dd756b44ec2b3aab Mon Sep 17 00:00:00 2001 From: David Cermak Date: Thu, 14 Nov 2024 12:37:22 +0100 Subject: [PATCH] fix(esp_netif): Prevent null deref when checking netif type Most esp_netif public API check for invalid arguments, but when enabling PPP the macros to check netif type could potentially dereference esp_netif without any null-check. Releted to https://github.com/espressif/esp-idf/issues/14816 --- components/esp_netif/lwip/esp_netif_lwip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_netif/lwip/esp_netif_lwip.c b/components/esp_netif/lwip/esp_netif_lwip.c index 8387e361b8..e7c538bdee 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -72,7 +72,7 @@ * @brief macros to check netif related data to evaluate interface type */ #if CONFIG_PPP_SUPPORT -#define _IS_NETIF_ANY_POINT2POINT_TYPE(netif) (netif->related_data && netif->related_data->is_point2point) +#define _IS_NETIF_ANY_POINT2POINT_TYPE(netif) (netif && netif->related_data && netif->related_data->is_point2point) #else #define _IS_NETIF_ANY_POINT2POINT_TYPE(netif) false #endif