[PATCH] powerpc/ps3: refactor strncpy usage

Kees Cook keescook at chromium.org
Thu Aug 17 13:06:29 AEST 2023


On Wed, Aug 16, 2023 at 09:39:24PM +0000, Justin Stitt wrote:
> `strncpy` is deprecated for use on NUL-terminated destination strings [1].
> 
> `make_first_field()` should use similar implementation to `make_field()`
> due to memcpy having more obvious behavior here. The end result yields
> the same behavior as the previous `strncpy`-based implementation
> including the NUL-padding.
> 
> Link: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings[1]
> Link: https://github.com/KSPP/linux/issues/90
> Cc: linux-hardening at vger.kernel.org
> Signed-off-by: Justin Stitt <justinstitt at google.com>

Reviewed-by: Kees Cook <keescook at chromium.org>

-- 
Kees Cook


More information about the Linuxppc-dev mailing list