diff options
author | Simon Glass <sjg@chromium.org> | 2021-05-13 19:39:17 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-07-15 18:42:05 -0400 |
commit | 9d9bec216d4207b3f3336eda2ca2ba73698574cb (patch) | |
tree | d59cbaf9c97e71f1e0770ebad73ea64e8ca63c5e /drivers/net | |
parent | d3fc3da9a4fb98104d004b025149ec6dadccc2cd (diff) | |
download | u-boot-9d9bec216d4207b3f3336eda2ca2ba73698574cb.zip u-boot-9d9bec216d4207b3f3336eda2ca2ba73698574cb.tar.gz u-boot-9d9bec216d4207b3f3336eda2ca2ba73698574cb.tar.bz2 |
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/sandbox-raw.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c index ce66ff7..99eb7a3 100644 --- a/drivers/net/sandbox-raw.c +++ b/drivers/net/sandbox-raw.c @@ -161,7 +161,7 @@ static int sb_eth_raw_of_to_plat(struct udevice *dev) ifname = dev_read_string(dev, "host-raw-interface"); if (ifname) { - strncpy(priv->host_ifname, ifname, IFNAMSIZ); + strlcpy(priv->host_ifname, ifname, IFNAMSIZ); printf(": Using %s from DT\n", priv->host_ifname); } if (dev_read_u32(dev, "host-raw-interface-idx", |