diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-12-13 14:04:50 +0300 |
|---|---|---|
| committer | Tyler Hicks <code@tyhicks.com> | 2025-12-24 00:23:23 +0300 |
| commit | 3bdc6cace25c3c7adfc073bb763bb52c9d1282c8 (patch) | |
| tree | c089f6bc2dacafa487c7664d8d4f62ea670ed319 | |
| parent | 5c31c9bf9e2ff0d6c065ff7f2ccf8a1e95ddbb49 (diff) | |
| download | linux-3bdc6cace25c3c7adfc073bb763bb52c9d1282c8.tar.xz | |
ecryptfs: Replace strcpy with strscpy in ecryptfs_set_default_crypt_stat_vals
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>
Signed-off-by: Tyler Hicks <code@tyhicks.com>
| -rw-r--r-- | fs/ecryptfs/crypto.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index b80f60863b5a..c84c7c3de4d9 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -20,6 +20,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> @@ -645,7 +646,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; |
