ecryptfs: Replace strcpy with strscpy in ecryptfs_cipher_code_to_string
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 13 Dec 2025 11:04:52 +0000 (12:04 +0100)
committerTyler Hicks <code@tyhicks.com>
Tue, 23 Dec 2025 21:23:23 +0000 (15:23 -0600)
commitc82f77a4ac9589a5d73d4caaa439fa670c684455
tree730dc87df52968dfd4739c89140f12776d11086e
parent3bdc6cace25c3c7adfc073bb763bb52c9d1282c8
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
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Tyler Hicks <code@tyhicks.com>
fs/ecryptfs/crypto.c
fs/ecryptfs/ecryptfs_kernel.h
fs/ecryptfs/keystore.c