public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs_sysfs_link_rpc_client(): Replace strcpy with strscpy
@ 2024-11-06  2:49 Daniel Yang
  2024-11-06 19:30 ` Benjamin Coddington
  2024-11-06 20:20 ` Roland Mainz
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Yang @ 2024-11-06  2:49 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker,
	open list:NFS, SUNRPC, AND LOCKD CLIENTS, open list
  Cc: Daniel Yang

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

Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-11-09 12:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06  2:49 [PATCH] nfs_sysfs_link_rpc_client(): Replace strcpy with strscpy Daniel Yang
2024-11-06 19:30 ` Benjamin Coddington
2024-11-06 20:20 ` Roland Mainz
2024-11-06 20:40   ` Benjamin Coddington
2024-11-09 11:11     ` Kernel strscpy() should be renamed to kstrscpy() " Sebastian Feld
2024-11-09 11:28       ` Benjamin Coddington
2024-11-09 12:01       ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox