* [PATCH net-next] net: l2tp_eth: Replace deprecated strcpy with strscpy in l2tp_eth_create
@ 2026-02-23 7:41 Thorsten Blum
2026-02-24 8:18 ` Simon Horman
2026-02-24 12:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-02-23 7:41 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Stanislav Fomichev
Cc: Thorsten Blum, netdev, linux-kernel
strcpy() has been deprecated [1] because it performs no bounds checking
on the destination buffer, which can lead to buffer overflows. Replace
it with the safer strscpy(). Use the two-argument version of strscpy()
to copy 'cfg->ifname'.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
net/l2tp/l2tp_eth.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index cf0b66f4fb29..a4956ef9574c 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -14,6 +14,7 @@
#include <linux/in.h>
#include <linux/etherdevice.h>
#include <linux/spinlock.h>
+#include <linux/string.h>
#include <net/sock.h>
#include <net/ip.h>
#include <net/icmp.h>
@@ -235,10 +236,10 @@ static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel,
int rc;
if (cfg->ifname) {
- strscpy(name, cfg->ifname, IFNAMSIZ);
+ strscpy(name, cfg->ifname);
name_assign_type = NET_NAME_USER;
} else {
- strcpy(name, L2TP_ETH_DEV_NAME);
+ strscpy(name, L2TP_ETH_DEV_NAME);
name_assign_type = NET_NAME_ENUM;
}
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: l2tp_eth: Replace deprecated strcpy with strscpy in l2tp_eth_create
2026-02-23 7:41 [PATCH net-next] net: l2tp_eth: Replace deprecated strcpy with strscpy in l2tp_eth_create Thorsten Blum
@ 2026-02-24 8:18 ` Simon Horman
2026-02-24 12:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-02-24 8:18 UTC (permalink / raw)
To: Thorsten Blum
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Stanislav Fomichev, netdev, linux-kernel
On Mon, Feb 23, 2026 at 08:41:34AM +0100, Thorsten Blum wrote:
> strcpy() has been deprecated [1] because it performs no bounds checking
> on the destination buffer, which can lead to buffer overflows. Replace
> it with the safer strscpy(). Use the two-argument version of strscpy()
> to copy 'cfg->ifname'.
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: l2tp_eth: Replace deprecated strcpy with strscpy in l2tp_eth_create
2026-02-23 7:41 [PATCH net-next] net: l2tp_eth: Replace deprecated strcpy with strscpy in l2tp_eth_create Thorsten Blum
2026-02-24 8:18 ` Simon Horman
@ 2026-02-24 12:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-24 12:50 UTC (permalink / raw)
To: Thorsten Blum
Cc: davem, edumazet, kuba, pabeni, horms, sdf, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 23 Feb 2026 08:41:34 +0100 you wrote:
> strcpy() has been deprecated [1] because it performs no bounds checking
> on the destination buffer, which can lead to buffer overflows. Replace
> it with the safer strscpy(). Use the two-argument version of strscpy()
> to copy 'cfg->ifname'.
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>
> [...]
Here is the summary with links:
- [net-next] net: l2tp_eth: Replace deprecated strcpy with strscpy in l2tp_eth_create
https://git.kernel.org/netdev/net-next/c/e5a80f5e67ce
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-24 12:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 7:41 [PATCH net-next] net: l2tp_eth: Replace deprecated strcpy with strscpy in l2tp_eth_create Thorsten Blum
2026-02-24 8:18 ` Simon Horman
2026-02-24 12:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox