net: Fix Covarity Defect 244093
authorJoe Hershberger <joe.hershberger@ni.com>
Tue, 30 Jul 2019 19:49:56 +0000 (14:49 -0500)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 4 Sep 2019 16:37:18 +0000 (11:37 -0500)
Don't allow unterminated strings

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
net/mdio-uclass.c

index 36a404ff449a5beddc2611fe167bd32663273efb..1c0d25272a36fd82ed34cb805c81eb9d302651a9 100644 (file)
@@ -75,7 +75,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);
+       strncpy(pdata->mii_bus->name, dev->name, MDIO_NAME_LEN - 1);
 
        return mdio_register(pdata->mii_bus);
 }