[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180629025135.12236-1-yuehaibing@huawei.com>
Date: Fri, 29 Jun 2018 10:51:35 +0800
From: YueHaibing <yuehaibing@...wei.com>
To: <simon@...kelleys.org.uk>, <kvalo@...eaurora.org>
CC: <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-wireless@...r.kernel.org>, <davem@...emloft.net>,
YueHaibing <yuehaibing@...wei.com>
Subject: [PATCH] atmel: using strlcpy() to avoid possible buffer overflows
'firmware' is a module param which may been longer than firmware_id,
so using strlcpy() to guard against overflows
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
---
drivers/net/wireless/atmel/atmel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c
index b01dc34..604d5ac 100644
--- a/drivers/net/wireless/atmel/atmel.c
+++ b/drivers/net/wireless/atmel/atmel.c
@@ -1519,7 +1519,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
priv->firmware_id[0] = '\0';
priv->firmware_type = fw_type;
if (firmware) /* module parameter */
- strcpy(priv->firmware_id, firmware);
+ strlcpy(priv->firmware_id, firmware, sizeof(priv->firmware_id));
priv->bus_type = card_present ? BUS_TYPE_PCCARD : BUS_TYPE_PCI;
priv->station_state = STATION_STATE_DOWN;
priv->do_rx_crc = 0;
--
2.7.0
Powered by blists - more mailing lists