public inbox for ecryptfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Yang <danielyangkang@gmail.com>
To: Tyler Hicks <code@tyhicks.com>,
	"GitAuthor: Daniel Yang" <danielyangkang@gmail.com>,
	ecryptfs@vger.kernel.org (open list:ECRYPT FILE SYSTEM),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] ecryptfs_parse_options(): Replace strcpy with strscpy
Date: Tue,  5 Nov 2024 18:25:26 -0800	[thread overview]
Message-ID: <20241106022527.493421-1-danielyangkang@gmail.com> (raw)

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


                 reply	other threads:[~2024-11-06  2:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241106022527.493421-1-danielyangkang@gmail.com \
    --to=danielyangkang@gmail.com \
    --cc=code@tyhicks.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox