Re: [PATCH v2] nvdimm/btt: replace deprecated strncpy with strscpy

From: Kees Cook
Date: Thu Nov 30 2023 - 17:01:21 EST


On Thu, 19 Oct 2023 17:54:15 +0000, Justin Stitt wrote:
> Found with grep.
>
> strncpy() is deprecated for use on NUL-terminated destination strings
> [1] and as such we should prefer more robust and less ambiguous string
> interfaces.
>
> We expect super->signature to be NUL-terminated based on its usage with
> memcmp against a NUL-term'd buffer:
> btt_devs.c:
> 253 | if (memcmp(super->signature, BTT_SIG, BTT_SIG_LEN) != 0)
> btt.h:
> 13 | #define BTT_SIG "BTT_ARENA_INFO\0"
>
> [...]

Applied to for-next/hardening, thanks!

[1/1] nvdimm/btt: replace deprecated strncpy with strscpy
https://git.kernel.org/kees/c/26b4ca3c3901

Take care,

--
Kees Cook