Re: [PATCH] ksmbd: Replace strcpy + strcat with scnprintf in convert_to_nt_pathname

Thorsten Blum
2025-11-19T01:23:17Z

On 18. Nov 2025, at 23:35, David Laight wrote:
> On Tue, 18 Nov 2025 13:25:56 +0100
> Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
>> strcpy() is deprecated and using strcat() is discouraged; use the safer
>> scnprintf() instead. No functional changes.
>>
>> Link: https://github.com/KSPP/linux/issues/88
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>> ---
>> [...]
>
> Ugg...
> If nothing else non-constant formats are definitely frowned upon.
> Never mind the non-trivial cpu cost of printf.
>
> OTOH once you've got the string length, just use memcpy().
> That way you know you won't overflow the malloc buffer even
> if someone changes the string on you.

Ok, I'll submit a v2.

Thanks,
Thorsten