summaryrefslogtreecommitdiff
path: root/net/sunrpc
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-27 08:49:57 -0400
commit57cc29630e87a5e5a3861c876e51ae383d8ddc7a (patch)
tree45e1ca1a0e3d5ba929e982776835bcf05f355fd5 /net/sunrpc
parentd36eab54d1bedeb62c49b1d68cf03809e35ded46 (diff)
downloadlinux-next-57cc29630e87a5e5a3861c876e51ae383d8ddc7a.tar.gz
linux-next-57cc29630e87a5e5a3861c876e51ae383d8ddc7a.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>
Diffstat (limited to 'net/sunrpc')
-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) ^