From a6980fce4cdec90d3ab1e47f5fed7a63d4691cbf Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 2 Mar 2017 14:50:58 +1100 Subject: [PATCH] lwip: Use strlcpy() instead of memcpy() to copy hostname to static buffer --- components/tcpip_adapter/tcpip_adapter_lwip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tcpip_adapter/tcpip_adapter_lwip.c b/components/tcpip_adapter/tcpip_adapter_lwip.c index 6e1661754..c98825ec6 100644 --- a/components/tcpip_adapter/tcpip_adapter_lwip.c +++ b/components/tcpip_adapter/tcpip_adapter_lwip.c @@ -726,7 +726,7 @@ esp_err_t tcpip_adapter_set_hostname(tcpip_adapter_if_t tcpip_if, const char *ho p_netif = esp_netif[tcpip_if]; if (p_netif != NULL) { memset(hostinfo[tcpip_if], 0, sizeof(hostinfo[tcpip_if])); - memcpy(hostinfo[tcpip_if], hostname, strlen(hostname)); + strlcpy(hostinfo[tcpip_if], hostname, sizeof(hostinfo[tcpip_if])); p_netif->hostname = hostinfo[tcpip_if]; return ESP_OK; } else {