* [PATCH] net: ipconfig: use strscpy to replace strlcpy
@ 2022-07-01 10:55 XueBing Chen
2022-07-04 9:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: XueBing Chen @ 2022-07-01 10:55 UTC (permalink / raw)
To: davem, yoshfuji, dsahern, edumazet, kuba, pabeni; +Cc: netdev, linux-kernel
The strlcpy should not be used because it doesn't limit the source
length. Preferred is strscpy.
Signed-off-by: XueBing Chen <chenxuebing@jari.cn>
---
net/ipv4/ipconfig.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 2342debd7066..e90bc0aa85c7 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1765,15 +1765,15 @@ static int __init ip_auto_config_setup(char *addrs)
case 4:
if ((dp = strchr(ip, '.'))) {
*dp++ = '\0';
- strlcpy(utsname()->domainname, dp,
+ strscpy(utsname()->domainname, dp,
sizeof(utsname()->domainname));
}
- strlcpy(utsname()->nodename, ip,
+ strscpy(utsname()->nodename, ip,
sizeof(utsname()->nodename));
ic_host_name_set = 1;
break;
case 5:
- strlcpy(user_dev_name, ip, sizeof(user_dev_name));
+ strscpy(user_dev_name, ip, sizeof(user_dev_name));
break;
case 6:
if (ic_proto_name(ip) == 0 &&
@@ -1820,7 +1820,7 @@ __setup("nfsaddrs=", nfsaddrs_config_setup);
static int __init vendor_class_identifier_setup(char *addrs)
{
- if (strlcpy(vendor_class_identifier, addrs,
+ if (strscpy(vendor_class_identifier, addrs,
sizeof(vendor_class_identifier))
>= sizeof(vendor_class_identifier))
pr_warn("DHCP: vendorclass too long, truncated to \"%s\"\n",
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: ipconfig: use strscpy to replace strlcpy
2022-07-01 10:55 [PATCH] net: ipconfig: use strscpy to replace strlcpy XueBing Chen
@ 2022-07-04 9:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-04 9:30 UTC (permalink / raw)
To: XueBing Chen
Cc: davem, yoshfuji, dsahern, edumazet, kuba, pabeni, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Fri, 1 Jul 2022 18:55:17 +0800 (GMT+08:00) you wrote:
> The strlcpy should not be used because it doesn't limit the source
> length. Preferred is strscpy.
>
> Signed-off-by: XueBing Chen <chenxuebing@jari.cn>
> ---
> net/ipv4/ipconfig.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Here is the summary with links:
- net: ipconfig: use strscpy to replace strlcpy
https://git.kernel.org/netdev/net-next/c/634b215b7307
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] 2+ messages in thread
end of thread, other threads:[~2022-07-04 9:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 10:55 [PATCH] net: ipconfig: use strscpy to replace strlcpy XueBing Chen
2022-07-04 9:30 ` 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;
as well as URLs for NNTP newsgroup(s).