From: Ruben Wauters <rubenru09@aol.com>
To: "David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Cc: Ruben Wauters <rubenru09@aol.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next] ipv4: ip_tunnel: Replace strcpy use with strscpy
Date: Thu, 1 May 2025 02:23:00 +0100 [thread overview]
Message-ID: <20250501012555.92688-1-rubenru09@aol.com> (raw)
In-Reply-To: <20250501012555.92688-1-rubenru09.ref@aol.com>
Use of strcpy is decpreated, replaces the use of strcpy with strscpy as
recommended.
I am aware there is an explicit bounds check above, however using
strscpy protects against buffer overflows in any future code, and there
is no good reason I can see to not use it.
Signed-off-by: Ruben Wauters <rubenru09@aol.com>
---
net/ipv4/ip_tunnel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 3913ec89ad20..9724bbbd0e0a 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -247,7 +247,7 @@ static struct net_device *__ip_tunnel_create(struct net *net,
} else {
if (strlen(ops->kind) > (IFNAMSIZ - 3))
goto failed;
- strcpy(name, ops->kind);
+ strscpy(name, ops->kind);
strcat(name, "%d");
}
--
2.48.1
next parent reply other threads:[~2025-05-01 1:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250501012555.92688-1-rubenru09.ref@aol.com>
2025-05-01 1:23 ` Ruben Wauters [this message]
2025-05-01 15:39 ` Simon Horman
2025-05-01 16:51 ` Ruben Wauters
2025-05-02 9:38 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250501012555.92688-1-rubenru09@aol.com \
--to=rubenru09@aol.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®