From: Len Baker Date: Sat, 17 Jul 2021 15:51:45 +0000 (+0200) Subject: staging/rtl8712: Remove all strcpy() uses in favor of strscpy() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d2c57736c430a3fa2c5de2146642eb41f8fe6ca7;p=linux.git staging/rtl8712: Remove all strcpy() uses in favor of strscpy() strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy(). Signed-off-by: Len Baker Link: https://lore.kernel.org/r/20210717155145.15041-1-len.baker@gmx.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 2214aca097308..9502f6aa53060 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -203,7 +203,7 @@ struct net_device *r8712_init_netdev(void) if (!pnetdev) return NULL; if (dev_alloc_name(pnetdev, ifname) < 0) { - strcpy(ifname, "wlan%d"); + strscpy(ifname, "wlan%d", sizeof(ifname)); dev_alloc_name(pnetdev, ifname); } padapter = netdev_priv(pnetdev);