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
This commit is contained in:
David Cermak 2024-11-14 12:37:22 +01:00
parent 91baeeb61c
commit 8ee8cb11f6

View File

@ -71,7 +71,7 @@
* @brief macros to check netif related data to evaluate interface type * @brief macros to check netif related data to evaluate interface type
*/ */
#if CONFIG_PPP_SUPPORT #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 #else
#define _IS_NETIF_ANY_POINT2POINT_TYPE(netif) false #define _IS_NETIF_ANY_POINT2POINT_TYPE(netif) false
#endif #endif