summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Laight <david.laight.linux@gmail.com>2026-06-08 10:55:00 +0100
committerChuck Lever <cel@kernel.org>2026-07-05 21:07:22 -0400
commitdc91945d5064986b8b52f48709bdd4c61978254e (patch)
treee93eb167cf0753d0cd6cbbbe87ebcdd0229555e9
parent77f499f88196e53911d3d20b473ad68f2f7043dd (diff)
downloadlinux-next-dc91945d5064986b8b52f48709bdd4c61978254e.tar.gz
linux-next-dc91945d5064986b8b52f48709bdd4c61978254e.zip
net/sunrpc/svcauth_unix: Use strscpy() to copy strings into arrays
Replacing strcpy() with strscpy() ensures that overflow of the target buffer cannot happen. Signed-off-by: David Laight <david.laight.linux@gmail.com> Link: https://patch.msgid.link/20260608095523.2606-16-david.laight.linux@gmail.com Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
-rw-r--r--net/sunrpc/svcauth_unix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 64a2658faddb..aebd97e7f66c 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -133,7 +133,7 @@ static void ip_map_init(struct cache_head *cnew, struct cache_head *citem)
struct ip_map *new = container_of(cnew, struct ip_map, h);
struct ip_map *item = container_of(citem, struct ip_map, h);
- strcpy(new->m_class, item->m_class);
+ strscpy(new->m_class, item->m_class);
new->m_addr = item->m_addr;
}
static void update(struct cache_head *cnew, struct cache_head *citem)
@@ -296,7 +296,7 @@ static struct ip_map *__ip_map_lookup(struct cache_detail *cd, char *class,
struct ip_map ip;
struct cache_head *ch;
- strcpy(ip.m_class, class);
+ strscpy(ip.m_class, class);
ip.m_addr = *addr;
ch = sunrpc_cache_lookup_rcu(cd, &ip.h,
hash_str(class, IP_HASHBITS) ^