Skip to content

Commit

Permalink
staging/rtl8712: Remove all strcpy() uses in favor of strscpy()
Browse files Browse the repository at this point in the history
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 <len.baker@gmx.com>
Link: https://lore.kernel.org/r/20210717155145.15041-1-len.baker@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Len Baker authored and gregkh committed Jul 21, 2021
1 parent 3963020 commit d2c5773
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/rtl8712/os_intfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d2c5773

Please sign in to comment.