linux/arch/um
Justin Stitt e30955d029 um: vector: refactor deprecated strncpy
`strncpy` is deprecated for use on NUL-terminated destination strings [1].

A suitable replacement is `strscpy` [2] due to the fact that it
guarantees NUL-termination on its destination buffer argument which is
_not_ the case for `strncpy`!

In this case, we are able to drop the now superfluous `... - 1`
instances because `strscpy` will automatically truncate the last byte by
setting it to a NUL byte if the source size exceeds the destination size
or if the source string is not NUL-terminated.

I've also opted to remove the seemingly useless char* casts. I'm not
sure why they're present at all since (after expanding the `ifr_name`
macro) `ifr.ifr_ifrn.ifrn_name` is a char* already.

All in all, `strscpy` is a more robust and less ambiguous interface
while also letting us remove some `... -1`'s which cleans things up a
bit.

[1]: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[2]: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html

Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
Acked-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
2023-08-26 22:42:50 +02:00
..
configs um: Fix hostaudio build errors 2023-08-19 23:30:22 +02:00
drivers um: vector: refactor deprecated strncpy 2023-08-26 22:42:50 +02:00
include um: Remove strlcpy usage 2023-08-19 22:24:39 +02:00
kernel x86/alternative: Rename apply_ibt_endbr() 2023-07-10 09:52:23 +02:00
os-Linux um: Remove strlcpy usage 2023-08-19 22:24:39 +02:00
scripts um: prevent user code in modules 2023-04-20 23:06:38 +02:00
.gitignore um: gitignore: Add kernel/capflags.c 2021-12-21 21:22:43 +01:00
Kbuild um: use obj-y to descend into arch/um/*/ 2023-08-26 22:41:34 +02:00
Kconfig Landlock updates for v6.5-rc1 2023-06-27 17:10:27 -07:00
Kconfig.debug um: Disable CONFIG_GCOV with MODULES 2021-04-15 23:10:33 +02:00
Makefile um: use obj-y to descend into arch/um/*/ 2023-08-26 22:41:34 +02:00
Makefile-os-Linux
Makefile-skas