mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
fix(esp_netif): reject NULL hostname in esp_netif_set_hostname_api
esp_netif_set_hostname_api() dereferenced hostname via strlen() without checking it for NULL first, causing a NULL pointer dereference.
This commit is contained in:
@@ -1672,12 +1672,12 @@ static esp_err_t esp_netif_set_hostname_api(esp_netif_api_msg_t *msg)
|
||||
esp_netif_t *esp_netif = msg->esp_netif;
|
||||
const char *hostname = msg->data;
|
||||
|
||||
ESP_LOGD(TAG, "%s esp_netif:%p hostname %s", __func__, esp_netif, hostname);
|
||||
|
||||
if (!esp_netif) {
|
||||
if (!esp_netif || hostname == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
ESP_LOGV(TAG, "%s esp_netif:%p hostname %s", __func__, esp_netif, hostname);
|
||||
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
|
||||
struct netif *p_netif = esp_netif->lwip_netif;
|
||||
|
||||
Reference in New Issue
Block a user