Skip to contentSkip to conversation

brcmfmac: use strlcpy() instead of strcpy()

PATCH In review [email protected] 2 participants 2 messages May 21, 2019 – May 28, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcmfmac: use strlcpy() instead of strcpy()

From: Neo Jou <[email protected]>

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.

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +1 -1
index 96b8d5b..9e0bd2b 100644
@@ -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",
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · [email protected] wrote:

From: Neo Jou <[email protected]>

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.

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

bbfab331e3ab brcmfmac: use strlcpy() instead of strcpy()

Signature · 3 lines
https://patchwork.kernel.org/patch/10953203/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches