[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1611455017-2210-1-git-send-email-stephenzhangzsd@gmail.com>
Date: Sun, 24 Jan 2021 10:23:37 +0800
From: Stephen Zhang <stephenzhangzsd@...il.com>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Stephen Zhang <stephenzhangzsd@...il.com>
Subject: [PATCH] mm/memfd: replace strcpy() by strscpy()
The strcpy() function is being deprecated. Replace it by the safer
strscpy().
Signed-off-by: Stephen Zhang <stephenzhangzsd@...il.com>
---
mm/memfd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memfd.c b/mm/memfd.c
index 2647c89..bb90862 100644
--- a/mm/memfd.c
+++ b/mm/memfd.c
@@ -278,7 +278,7 @@ long memfd_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
if (!name)
return -ENOMEM;
- strcpy(name, MFD_NAME_PREFIX);
+ strscpy(name, MFD_NAME_PREFIX, len + MFD_NAME_PREFIX_LEN);
if (copy_from_user(&name[MFD_NAME_PREFIX_LEN], uname, len)) {
error = -EFAULT;
goto err_name;
--
1.8.3.1
Powered by blists - more mailing lists