From: Jerome Forissier Date: Fri, 22 Nov 2024 12:35:29 +0000 (+0100) Subject: net: lwip: fix dhcp_loop() X-Git-Url: http://git.dujemihanovic.xyz/html/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=8c95d84b39fc0886a4417c5ddefc2ea05217c0ac;p=u-boot.git net: lwip: fix dhcp_loop() The local variables ipstr, maskstr and gwstr in static function dhcp_loop() cannot be pointers to read-only data, since they may be written to in case the device index is > 0. Therefore make them char arrays allocated on the stack. Reported-by: Ilias Apalodimas Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- diff --git a/net/lwip/dhcp.c b/net/lwip/dhcp.c index 23b5622692..bfc72ca6c5 100644 --- a/net/lwip/dhcp.c +++ b/net/lwip/dhcp.c @@ -27,9 +27,9 @@ static void call_lwip_dhcp_fine_tmr(void *ctx) static int dhcp_loop(struct udevice *udev) { - char *ipstr = "ipaddr\0\0"; - char *maskstr = "netmask\0\0"; - char *gwstr = "gatewayip\0\0"; + char ipstr[] = "ipaddr\0\0"; + char maskstr[] = "netmask\0\0"; + char gwstr[] = "gatewayip\0\0"; unsigned long start; struct netif *netif; struct dhcp *dhcp;