public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <code@tyhicks.com>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Ard Biesheuvel <ardb@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Eric Biggers <ebiggers@kernel.org>,
	ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] ecryptfs: Replace strcpy with strscpy in ecryptfs_set_default_crypt_stat_vals
Date: Tue, 23 Dec 2025 14:57:19 -0600	[thread overview]
Message-ID: <aUsCLz4PRB_P33P3@yaupon> (raw)
In-Reply-To: <20251213110502.302950-2-thorsten.blum@linux.dev>

On 2025-12-13 12:04:50, Thorsten Blum wrote:
> strcpy() has been deprecated [1] because it performs no bounds checking
> on the destination buffer, which can lead to buffer overflows. Replace
> it with the safer strscpy().
> 
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Acked-by: Tyler Hicks <code@tyhicks.com>

> ---
>  fs/ecryptfs/crypto.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
> index 69536cacdea8..2c37ee6a8be1 100644
> --- a/fs/ecryptfs/crypto.c
> +++ b/fs/ecryptfs/crypto.c
> @@ -21,6 +21,7 @@
>  #include <linux/file.h>
>  #include <linux/scatterlist.h>
>  #include <linux/slab.h>
> +#include <linux/string.h>
>  #include <linux/unaligned.h>
>  #include <linux/kernel.h>
>  #include <linux/xattr.h>
> @@ -717,7 +718,7 @@ static void ecryptfs_set_default_crypt_stat_vals(
>  	ecryptfs_copy_mount_wide_flags_to_inode_flags(crypt_stat,
>  						      mount_crypt_stat);
>  	ecryptfs_set_default_sizes(crypt_stat);
> -	strcpy(crypt_stat->cipher, ECRYPTFS_DEFAULT_CIPHER);
> +	strscpy(crypt_stat->cipher, ECRYPTFS_DEFAULT_CIPHER);
>  	crypt_stat->key_size = ECRYPTFS_DEFAULT_KEY_BYTES;
>  	crypt_stat->flags &= ~(ECRYPTFS_KEY_VALID);
>  	crypt_stat->file_version = ECRYPTFS_FILE_VERSION;
> -- 
> Thorsten Blum <thorsten.blum@linux.dev>
> GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4
> 

      parent reply	other threads:[~2025-12-23 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-13 11:04 [PATCH 1/3] ecryptfs: Replace strcpy with strscpy in ecryptfs_set_default_crypt_stat_vals Thorsten Blum
2025-12-13 11:04 ` [PATCH 2/3] ecryptfs: Replace strcpy with strscpy in ecryptfs_cipher_code_to_string Thorsten Blum
2025-12-23 20:59   ` Tyler Hicks
2025-12-13 11:04 ` [PATCH 3/3] ecryptfs: Replace strcpy with strscpy in ecryptfs_validate_options Thorsten Blum
2025-12-23 21:00   ` Tyler Hicks
2025-12-23 20:57 ` Tyler Hicks [this message]

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=aUsCLz4PRB_P33P3@yaupon \
    --to=code@tyhicks.com \
    --cc=ardb@kernel.org \
    --cc=brauner@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=ecryptfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thorsten.blum@linux.dev \
    /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