[PATCH] nfs_sysfs_link_rpc_client(): Replace strcpy with strscpy

From: Daniel Yang
Date: Tue Nov 05 2024 - 21:50:21 EST


The function strcpy is deprecated due to lack of bounds checking. The
recommended replacement is strscpy.

Signed-off-by: Daniel Yang <danielyangkang@xxxxxxxxx>
---
fs/nfs/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c
index bf378ecd5..f3d0b2ef9 100644
--- a/fs/nfs/sysfs.c
+++ b/fs/nfs/sysfs.c
@@ -280,7 +280,7 @@ void nfs_sysfs_link_rpc_client(struct nfs_server *server,
char name[RPC_CLIENT_NAME_SIZE];
int ret;

- strcpy(name, clnt->cl_program->name);
+ strscpy(name, clnt->cl_program->name);
strcat(name, uniq ? uniq : "");
strcat(name, "_client");

--
2.39.5