summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2021-09-27 14:22:00 +0300
committerRamon Fried <rfried.dev@gmail.com>2021-09-28 18:50:57 +0300
commitbf35c3121aa58eec03990bd5bd83ad1576106046 (patch)
tree5601445d0599a3a3dbd3d5ebc6b296c4a6709e7f /net
parent977b53f0b30e833b3155c247f48014363f9cfcf0 (diff)
downloadu-boot-bf35c3121aa58eec03990bd5bd83ad1576106046.tar.gz
u-boot-bf35c3121aa58eec03990bd5bd83ad1576106046.tar.bz2
u-boot-bf35c3121aa58eec03990bd5bd83ad1576106046.zip
net: mdio-uclass: rewrite dm_mdio_post_probe using strlcpy
dm_mdio_post_probe used to be vulnerable after truncation, but has been patched by commit 398e7512d8d7 ("net: Fix Covarity Defect 244093"). Nonetheless, we can use strlcpy like the rest of the code base now, which yields the same result. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/mdio-uclass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c
index 1b687765b8..e74e34f78f 100644
--- a/net/mdio-uclass.c
+++ b/net/mdio-uclass.c
@@ -101,7 +101,7 @@ static int dm_mdio_post_probe(struct udevice *dev)
pdata->mii_bus->write = mdio_write;
pdata->mii_bus->reset = mdio_reset;
pdata->mii_bus->priv = dev;
- strncpy(pdata->mii_bus->name, dev->name, MDIO_NAME_LEN - 1);
+ strlcpy(pdata->mii_bus->name, dev->name, MDIO_NAME_LEN);
return mdio_register(pdata->mii_bus);
}