summaryrefslogtreecommitdiff
path: root/fs/ecryptfs/ecryptfs_kernel.h
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-12-13 12:04:52 +0100
committerTyler Hicks <code@tyhicks.com>2025-12-23 15:23:23 -0600
commitc82f77a4ac9589a5d73d4caaa439fa670c684455 (patch)
tree730dc87df52968dfd4739c89140f12776d11086e /fs/ecryptfs/ecryptfs_kernel.h
parent3bdc6cace25c3c7adfc073bb763bb52c9d1282c8 (diff)
downloadlinux-next-c82f77a4ac9589a5d73d4caaa439fa670c684455.tar.gz
linux-next-c82f77a4ac9589a5d73d4caaa439fa670c684455.zip
ecryptfs: Replace strcpy with strscpy in ecryptfs_cipher_code_to_string
strcpy() has been deprecated [1] because it performs no bounds checking on the destination buffer, which can lead to buffer overflows. Since the parameter 'char *str' is just a pointer with no size information, extend the function with a 'size' parameter to pass the destination buffer's size as an additional argument. Adjust the call sites accordingly. 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>
Diffstat (limited to 'fs/ecryptfs/ecryptfs_kernel.h')
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index ba59f976a962..54e780186ac6 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -571,7 +571,7 @@ int ecryptfs_read_and_validate_header_region(struct inode *inode);
int ecryptfs_read_and_validate_xattr_region(struct dentry *dentry,
struct inode *inode);
u8 ecryptfs_code_for_cipher_string(char *cipher_name, size_t key_bytes);
-int ecryptfs_cipher_code_to_string(char *str, u8 cipher_code);
+int ecryptfs_cipher_code_to_string(char *str, size_t size, u8 cipher_code);
void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat);
int ecryptfs_generate_key_packet_set(char *dest_base,
struct ecryptfs_crypt_stat *crypt_stat,