summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Goodbody <andrew.goodbody@linaro.org>2025-07-17 12:09:15 +0100
committerTom Rini <trini@konsulko.com>2025-07-24 13:30:20 -0600
commit5c0827eededc8392472823d8e3e50cd0f5fad47b (patch)
tree0a93e4422494750507e30f19791c9315548992aa
parent70a4d1fa1ddb2f5f8f9a27442563f182549abbb5 (diff)
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>
-rw-r--r--drivers/net/sandbox-raw-bus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/sandbox-raw-bus.c b/drivers/net/sandbox-raw-bus.c
index 15670d6d24a..c698a07c784 100644
--- a/drivers/net/sandbox-raw-bus.c
+++ b/drivers/net/sandbox-raw-bus.c
@@ -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;
}