]> git.ipfire.org Git - thirdparty/linux.git/commit
ksmbd: Replace strcpy + strcat to improve convert_to_nt_pathname
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 19 Nov 2025 13:02:30 +0000 (14:02 +0100)
committerSteve French <stfrench@microsoft.com>
Mon, 1 Dec 2025 03:11:45 +0000 (21:11 -0600)
commitdc81b8f4f0fc9e1be0c9ce8a918503e175b2c9b2
tree271db5650fd15ef4e511b690e6e62c49d61f39ca
parentc4a2a49f7df48147529158a092edfde1597d12f3
ksmbd: Replace strcpy + strcat to improve convert_to_nt_pathname

strcpy() is deprecated [1] and using strcat() is discouraged. Replace
them by assigning the prefix directly and by using memcpy() to copy the
pathname. Using memcpy() is safe because we already know the length of
the source string and that it is guaranteed to be NUL-terminated.

Allocate only as many bytes as needed and replace kzalloc() with
kmalloc() since memcpy() overwrites the entire buffer anyway.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/misc.c