From e0dc4f125456e57347a6d016bd7209f064135b1d Mon Sep 17 00:00:00 2001 From: Bruce Allan Date: Thu, 6 Jan 2011 14:29:50 +0000 Subject: e1000e: properly bounds-check string functions Use string functions with bounds checking rather than their non-bounds checking counterparts, and do not hard code these boundaries. Signed-off-by: Bruce Allan Tested-by: Emil Tantilov Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/e1000e/netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/e1000e/netdev.c') diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 5498689ac20c..98729a6fb096 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -5639,7 +5639,7 @@ static void e1000_print_device_info(struct e1000_adapter *adapter) ret_val = e1000_read_pba_string_generic(hw, pba_str, E1000_PBANUM_LENGTH); if (ret_val) - strcpy(pba_str, "Unknown"); + strncpy((char *)pba_str, "Unknown", sizeof(pba_str) - 1); e_info("MAC: %d, PHY: %d, PBA No: %s\n", hw->mac.type, hw->phy.type, pba_str); } @@ -5968,7 +5968,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, if (!(adapter->flags & FLAG_HAS_AMT)) e1000_get_hw_control(adapter); - strcpy(netdev->name, "eth%d"); + strncpy(netdev->name, "eth%d", sizeof(netdev->name) - 1); err = register_netdev(netdev); if (err) goto err_register; -- cgit v1.2.2