sandbox: eth-raw: Prevent possible buffer overflow

Instead of strcpy which is unbounded use strlcpy to ensure that the
receiving buffer cannot be overflowed.

This issue found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
This commit is contained in:
Andrew Goodbody
2025-07-17 12:09:15 +01:00
committed by Tom Rini
parent 70a4d1fa1d
commit 5c0827eede

View File

@@ -42,7 +42,7 @@ static int eth_raw_bus_post_bind(struct udevice *dev)
device_probe(child);
priv = dev_get_priv(child);
if (priv) {
strcpy(priv->host_ifname, i->if_name);
strlcpy(priv->host_ifname, i->if_name, IFNAMSIZ);
priv->host_ifindex = i->if_index;
priv->local = local;
}