Re: [PATCH v2] ksmbd: Replace strcpy + strcat to improve convert_to_nt_pathname

From: Namjae Jeon

Date: Thu Nov 20 2025 - 03:35:53 EST


On Wed, Nov 19, 2025 at 10:03 PM Thorsten Blum <thorsten.blum@xxxxxxxxx> wrote:
>
> 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 [1]
> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
Applied it to #ksmbd-for-next-next.
Thanks!