[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aUsCLz4PRB_P33P3@yaupon>
Date: Tue, 23 Dec 2025 14:57:19 -0600
From: Tyler Hicks <code@...icks.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Ard Biesheuvel <ardb@...nel.org>,
Christian Brauner <brauner@...nel.org>,
Eric Biggers <ebiggers@...nel.org>, ecryptfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] ecryptfs: Replace strcpy with strscpy in
ecryptfs_set_default_crypt_stat_vals
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@...ux.dev>
Acked-by: Tyler Hicks <code@...icks.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@...ux.dev>
> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
>
Powered by blists - more mailing lists