linux/arch/um
Justin Stitt e0bbf92682 um,ethertap: Replace deprecated strncpy() with strscpy()
`strncpy` is deprecated for use on NUL-terminated destination strings [1].

`gate_buf` should always be NUL-terminated and does not require
NUL-padding. It is used as a string arg inside an argv array given to
`run_helper()`. Due to this, let's use `strscpy` as it guarantees
NUL-terminated on the destination buffer preventing potential buffer
overreads [2].

This exact invocation was changed from `strcpy` to `strncpy` in commit
7879b1d94b ("um,ethertap: use strncpy") back in 2015. Let's continue
hardening our `str*cpy` apis and use the newer and safer `strscpy`!

Link: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings[1]
Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230911-strncpy-arch-um-os-linux-drivers-ethertap_user-c-v1-1-d9e53f52ab32@google.com
Signed-off-by: Kees Cook <keescook@chromium.org>
2023-09-29 11:37:50 -07:00
..
configs um: Fix hostaudio build errors 2023-08-19 23:30:22 +02:00
drivers This pull request contains the following changes for UML: 2023-09-04 11:32:21 -07:00
include This pull request contains the following changes for UML: 2023-09-04 11:32:21 -07:00
kernel um: fix 3 instances of -Wmissing-prototypes 2023-08-26 22:45:05 +02:00
os-Linux um,ethertap: Replace deprecated strncpy() with strscpy() 2023-09-29 11:37:50 -07: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