Skip to content
Commit cfd01210 authored by Justin Stitt's avatar Justin Stitt Committed by Heiko Carstens
Browse files

s390/ipl: refactor deprecated strncpy

`strncpy` is deprecated for use on NUL-terminated destination strings [1].

Use `strscpy` which has the same behavior as `strncpy` here with the
extra safeguard of guaranteeing NUL-termination of destination
strings.  In it's current form, this may result in silent truncation
if the src string has the same size as the destination string.

[hca@linux.ibm.com: use strscpy() instead of strscpy_pad()]
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@vger.kernel.org
Signed-off-by: default avatarJustin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20230811-arch-s390-kernel-v1-1-7edbeeab3809@google.com


Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 979fe44a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment