diff options
author | YueHaibing <yuehaibing@huawei.com> | 2018-06-30 08:33:41 +0200 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-07-04 17:15:06 +0200 |
commit | f9cbaeb52930342059429f56d0b9f05c8d54c0ba (patch) | |
tree | 28963ff600a1af119033feb95b510e7112145f5b /drivers/net/wireless/atmel | |
parent | wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout (diff) | |
download | linux-f9cbaeb52930342059429f56d0b9f05c8d54c0ba.tar.xz linux-f9cbaeb52930342059429f56d0b9f05c8d54c0ba.zip |
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. Also priv is allocated
with zeroed memory,no need to set firmware_id[0] to '\0'.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/atmel')
-rw-r--r-- | drivers/net/wireless/atmel/atmel.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c index 0d8e0af3f74b..3ed3d9f6aae9 100644 --- a/drivers/net/wireless/atmel/atmel.c +++ b/drivers/net/wireless/atmel/atmel.c @@ -1516,10 +1516,9 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, priv->present_callback = card_present; priv->card = card; priv->firmware = NULL; - 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; |