Re: [PATCH v2] staging: qlge: Replace strncpy with strscpy

From: Ricardo Lopes
Date: Mon Oct 09 2023 - 14:54:18 EST


On Mon, Oct 09, 2023 at 09:44:37AM -0700, Kees Cook wrote:
> Thanks for working on this! Doing these replacements needs analysis of
> several issues that should be described in the commit log:
>
> - is the destination an %NUL-terminated string? (strncpy can produce
> non-%NUL-terminated strings and sometimes this is intentional.)
>
> - is the source %NUL-terminated? (Sometimes strncpy is used when memcpy,
> kmemdup_nul, or other things should be used.)
>
> - does the destination need to be %NUL padded? (strncpy does this
> padding, but it isn't always obvious if it's needed.) When padding is
> needed, strscpy_pad() should be used.

Thank you for the feedback Kees, I really appreciate it

Regards,

Ricardo Lopes