From c755a09b52c09b8d67ef35b4ac3166ca6e797bee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Miquel=20Sabat=C3=A9=20Sol=C3=A0?= Date: Mon, 29 Sep 2025 15:02:45 +0200 Subject: [PATCH] fuse: use strscpy instead of strcpy MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As pointed out in [1], strcpy() is deprecated in favor of strscpy(). Furthermore, the size of the buffer for 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 size of the string to be copied. [1] https://github.com/KSPP/linux/issues/88 Signed-off-by: Miquel Sabaté Solà Signed-off-by: Miklos Szeredi --- 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 8ef8134e1cd5d..70f364aa65412 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -699,7 +699,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.47.3