Re: [PATCH] scsi: hpsa: Replace deprecated strncpy() with strscpy_pad()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13. Feb 2025, at 20:14, David Laight wrote:
> On Wed, 12 Feb 2025 23:43:53 +0100
> Thorsten Blum <thorsten.blum@xxxxxxxxx> wrote:
> 
>> strncpy() is deprecated for NUL-terminated destination buffers [1].
>> 
>> Replace memset() and strncpy() with strscpy_pad() to copy the version
>> string and fill the remaining bytes in the destination buffer with NUL
>> bytes. This avoids zeroing the memory before copying the string.
>> 
>> Compile-tested only.
>> 
>> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
>> Cc: linux-hardening@xxxxxxxxxxxxxxx
>> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
>> ---
> 
> Wrong.
> That will truncate maximum length strings.

Yes, I sent a v2 to fix this already.

https://lore.kernel.org/r/20250213114047.2366-2-thorsten.blum@xxxxxxxxx/

Thanks,
Thorsten






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux