From: Jerome Forissier Date: Mon, 18 Nov 2024 14:31:25 +0000 (+0100) Subject: net: lwip: fix get_udev_ipv4_info() X-Git-Url: http://git.dujemihanovic.xyz/html/static/gitweb.css?a=commitdiff_plain;h=7d80e7368e1012355695e1fb580e5b20c8de03b9;p=u-boot.git net: lwip: fix get_udev_ipv4_info() The local variables ipstr, maskstr and gwstr in static function get_udev_ipv4_info() 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 Reported-by: Adriano Cordova Link: https://lists.denx.de/pipermail/u-boot/2024-November/572066.html Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- diff --git a/net/lwip/net-lwip.c b/net/lwip/net-lwip.c index 470217781a..b863047f59 100644 --- a/net/lwip/net-lwip.c +++ b/net/lwip/net-lwip.c @@ -91,9 +91,9 @@ struct netif *net_lwip_get_netif(void) static int get_udev_ipv4_info(struct udevice *dev, ip4_addr_t *ip, ip4_addr_t *mask, ip4_addr_t *gw) { - 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"; int idx = dev_seq(dev); char *env;