[PATCH] mm/memfd: replace strcpy() by strscpy()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The strcpy() function is being deprecated. Replace it by the safer
strscpy().

Signed-off-by: Stephen Zhang <stephenzhangzsd@xxxxxxxxx>
---
 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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux