OSDN Git Service

brcmfmac: use strlcpy() instead of strcpy()
authorNeo Jou <neojou@gmail.com>
Tue, 21 May 2019 09:12:20 +0000 (17:12 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 28 May 2019 12:25:33 +0000 (15:25 +0300)
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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c

index 7c9d06d..aa89d62 100644 (file)
@@ -258,7 +258,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",