From 8ee8cb11f687b63c06620ff5c27d43e807875c9e 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 c4b4253f45..cc651f1505 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -71,7 +71,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