mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 12:56:00 +01:00
sandbox: net: Ensure host name is always a valid string
At present if ifname is exactly IFNAMSIZ characters then it will result in an unterminated string. Fix this by using strlcpy() instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 316358) Acked-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
parent
d3fc3da9a4
commit
9d9bec216d
@ -161,7 +161,7 @@ static int sb_eth_raw_of_to_plat(struct udevice *dev)
|
|||||||
|
|
||||||
ifname = dev_read_string(dev, "host-raw-interface");
|
ifname = dev_read_string(dev, "host-raw-interface");
|
||||||
if (ifname) {
|
if (ifname) {
|
||||||
strncpy(priv->host_ifname, ifname, IFNAMSIZ);
|
strlcpy(priv->host_ifname, ifname, IFNAMSIZ);
|
||||||
printf(": Using %s from DT\n", priv->host_ifname);
|
printf(": Using %s from DT\n", priv->host_ifname);
|
||||||
}
|
}
|
||||||
if (dev_read_u32(dev, "host-raw-interface-idx",
|
if (dev_read_u32(dev, "host-raw-interface-idx",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user