summaryrefslogtreecommitdiff
path: root/drivers/net/ldpaa_eth
diff options
context:
space:
mode:
authorPankaj Bansal <pankaj.bansal@nxp.com>2018-08-02 16:31:28 +0530
committerYork Sun <york.sun@nxp.com>2018-08-08 08:23:49 -0700
commitc022ec039d3f32a153a1f7d3b1ffe3dd548d9be4 (patch)
tree99439be0344d6fc0edda3e015ed09fce6ddce65e /drivers/net/ldpaa_eth
parent6ce83fb3d6ac1cd25772b3c8c1265afbfa42f718 (diff)
fsl/mc: Limit the ethernet name to ETH_NAME_LEN
The ethernet name should be within the ETH_NAME_LEN, as this is the buffer space allocated to ethernet name. Otherwise, this causes buffer overflow. Reported-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'drivers/net/ldpaa_eth')
-rw-r--r--drivers/net/ldpaa_eth/ldpaa_eth.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 79facb4a44..a25b7cd906 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -993,8 +993,8 @@ static int ldpaa_eth_netdev_init(struct eth_device *net_dev,
int err;
struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;
- sprintf(net_dev->name, "DPMAC%d@%s", priv->dpmac_id,
- phy_interface_strings[enet_if]);
+ snprintf(net_dev->name, ETH_NAME_LEN, "DPMAC%d@%s", priv->dpmac_id,
+ phy_interface_strings[enet_if]);
net_dev->iobase = 0;
net_dev->init = ldpaa_eth_open;