[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250929130246.107478-2-mssola@mssola.com>
Date: Mon, 29 Sep 2025 15:02:45 +0200
From: Miquel Sabaté Solà <mssola@...ola.com>
To: linux-fsdevel@...r.kernel.org
Cc: miklos@...redi.hu,
linux-kernel@...r.kernel.org,
Miquel Sabaté Solà <mssola@...ola.com>
Subject: [PATCH v2 1/2] fs: fuse: Use strscpy instead of strcpy
As pointed out in [1], strcpy() is deprecated in favor of
strscpy().
Furthermore, the length of the name to be copied is well known at this
point since we are going to move the pointer by that much on the next
line. Hence, it's safe to assume 'namelen' for the length of the string
to be copied.
[1] https://github.com/KSPP/linux/issues/88
Signed-off-by: Miquel Sabaté Solà <mssola@...ola.com>
---
fs/fuse/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index ecaec0fea3a1..3809e280b157 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -504,7 +504,7 @@ static int get_security_context(struct dentry *entry, umode_t mode,
fctx->size = lsmctx.len;
ptr += sizeof(*fctx);
- strcpy(ptr, name);
+ strscpy(ptr, name, namelen);
ptr += namelen;
memcpy(ptr, lsmctx.context, lsmctx.len);
--
2.51.0
Powered by blists - more mailing lists