[PATCH] ecryptfs_parse_options(): Replace strcpy with strscpy

Daniel Yang posted 1 patch 2 weeks, 4 days ago
fs/ecryptfs/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] ecryptfs_parse_options(): Replace strcpy with strscpy
Posted by Daniel Yang 2 weeks, 4 days ago
The function strcpy is deprecated. strscpy is recommended to replace
strcpy. Instances of strcpy in ecryptfs_parse_options() don't require
strcpy return value so the different methods of detecting truncation
shouldn't be an issue here.

Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
---
 fs/ecryptfs/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 577c56302..d0b8ce70c 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -379,12 +379,12 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options,
 		int cipher_name_len = strlen(ECRYPTFS_DEFAULT_CIPHER);
 
 		BUG_ON(cipher_name_len > ECRYPTFS_MAX_CIPHER_NAME_SIZE);
-		strcpy(mount_crypt_stat->global_default_cipher_name,
+		strscpy(mount_crypt_stat->global_default_cipher_name,
 		       ECRYPTFS_DEFAULT_CIPHER);
 	}
 	if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES)
 	    && !fn_cipher_name_set)
-		strcpy(mount_crypt_stat->global_default_fn_cipher_name,
+		strscpy(mount_crypt_stat->global_default_fn_cipher_name,
 		       mount_crypt_stat->global_default_cipher_name);
 	if (!cipher_key_bytes_set)
 		mount_crypt_stat->global_default_cipher_key_size = 0;
-- 
2.39.5