diff mbox series

brcmfmac: use strlcpy() instead of strcpy()

Message ID 1558429940-8709-1-git-send-email-neojou@gmail.com (mailing list archive)
State Accepted
Commit bbfab331e3abd9fa8767eea6bf5c4684cdd4b934
Delegated to: Kalle Valo
Headers show
Series brcmfmac: use strlcpy() instead of strcpy() | expand

Commit Message

neojou@gmail.com May 21, 2019, 9:12 a.m. UTC
From: Neo Jou <neojou@gmail.com>

The function strcpy() is inherently not safe. Though the function
works without problems here, it would be better to use other safer
function, e.g. strlcpy(), to replace strcpy() still.

Signed-off-by: Neo Jou <neojou@gmail.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo May 28, 2019, 12:25 p.m. UTC | #1
neojou@gmail.com wrote:

> From: Neo Jou <neojou@gmail.com>
> 
> The function strcpy() is inherently not safe. Though the function
> works without problems here, it would be better to use other safer
> function, e.g. strlcpy(), to replace strcpy() still.
> 
> Signed-off-by: Neo Jou <neojou@gmail.com>

Patch applied to wireless-drivers-next.git, thanks.

bbfab331e3ab brcmfmac: use strlcpy() instead of strcpy()
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index 96b8d5b..9e0bd2b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -269,7 +269,7 @@  int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
 
 	/* query for 'ver' to get version info from firmware */
 	memset(buf, 0, sizeof(buf));
-	strcpy(buf, "ver");
+	strlcpy(buf, "ver", sizeof(buf));
 	err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf));
 	if (err < 0) {
 		bphy_err(drvr, "Retrieving version information failed, %d\n",