Re: [PATCH] btrfs: Replace deprecated strncpy() with strscpy_pad()
From: Thorsten Blum
Date: Tue Feb 25 2025 - 08:00:44 EST
On 25. Feb 2025, at 13:28, David Sterba wrote:
> On Tue, Feb 25, 2025 at 10:29:49AM +0100, Thorsten Blum wrote:
>> strncpy() is deprecated for NUL-terminated destination buffers. Use
>> strscpy_pad() instead and don't zero-initialize the param array.
>>
>> Compile-tested only.
>>
>> Link: https://github.com/KSPP/linux/issues/90
>> Cc: linux-hardening@xxxxxxxxxxxxxxx
>> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
>> ---
>
> I don't think we need the padding, so strscpy is probably ok. We copy
> input string to a temporary modifiable buffer and then match it against
> a table, so the NUL termination is ok.
Ok thanks, I'll submit a v2 later today.