Re: [PATCH v2] RISC-V: cpu: refactor deprecated strncpy
From: Conor Dooley
Date: Wed Aug 02 2023 - 16:24:04 EST
On Wed, Aug 02, 2023 at 12:21:58AM +0000, Justin Stitt wrote:
> `strncpy` is deprecated for use on NUL-terminated destination strings [1].
>
> Favor not copying strings onto stack and instead use strings directly.
> This avoids hard-coding sizes and buffer lengths all together.
>
> Link: https://github.com/KSPP/linux/issues/90
> Cc: linux-hardening@xxxxxxxxxxxxxxx
> Suggested-by: Kees Cook <keescook@xxxxxxxxxxxx>
> Signed-off-by: Justin Stitt <justinstitt@xxxxxxxxxx>
> ---
> Changes in v2:
> - Use strings directly instead of copying onto stack with `strscpy` (thanks Kees)
Yeah, that is what I was thinking of when I decried it as being horrid.
Reviewed-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
Thanks,
Conor.
Attachment:
signature.asc
Description: PGP signature