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:
committed by
Tom Rini
parent
70a4d1fa1d
commit
5c0827eede
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user