On Tue, Apr 08, 2025 at 12:28:40PM +0200, Thorsten Blum wrote:
> strncpy() is deprecated for NUL-terminated destination buffers; use
> strscpy() instead.
> 
> Since sli_config_cmd_init() already zeroes out the destination buffers,
> the potential NUL-padding by strncpy() is unnecessary. strscpy() copies
> only the required characters and guarantees NUL-termination.
> 
> And since all three destination buffers have a fixed length, strscpy()
> automatically determines their size using sizeof() when the argument is
> omitted. This makes any explicit sizeof() calls unnecessary.
> 
> The source strings are also NUL-terminated and meet the __must_be_cstr()
> requirement of strscpy().
> 
> No functional changes intended.
> 
> Link: https://github.com/KSPP/linux/issues/90
> Cc: [email protected]
> Signed-off-by: Thorsten Blum <[email protected]>

Reviewed-by: Kees Cook <[email protected]>

-- 
Kees Cook

Reply via email to