linux-stable/arch
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
..
alpha Kbuild updates for v6.6 2023-09-05 11:01:47 -07:00
arc ARC updates for v6.6 2023-09-04 15:38:24 -07:00
arm hardening: Provide Kconfig fragments for basic options 2023-09-22 09:50:55 -07:00
arm64 hardening: Provide Kconfig fragments for basic options 2023-09-22 09:50:55 -07:00
csky
hexagon
ia64 Kbuild updates for v6.6 2023-09-05 11:01:47 -07:00
loongarch LoongArch changes for v6.6 2023-09-08 12:16:52 -07:00
m68k ata changes for 6.6 2023-09-05 12:37:28 -07:00
microblaze Microblaze patches for 6.6-rc1 2023-09-05 10:15:22 -07:00
mips ARM: 2023-09-07 13:52:20 -07:00
nios2
openrisc OpenRISC updates for 6.6 2023-09-05 10:09:31 -07:00
parisc parisc architecture fixes and enhancements for kernel v6.6-rc2: 2023-09-13 11:35:53 -07:00
powerpc hardening: Provide Kconfig fragments for basic options 2023-09-22 09:50:55 -07:00
riscv riscv: errata: fix T-Head dcache.cva encoding 2023-09-12 13:58:40 -07:00
s390 Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
sh sh updates for v6.6 2023-09-09 14:46:57 -07:00
sparc ata changes for 6.6 2023-09-05 12:37:28 -07:00
um um,ethertap: Replace deprecated strncpy() with strscpy() 2023-09-29 11:37:50 -07:00
x86 hardening: Provide Kconfig fragments for basic options 2023-09-22 09:50:55 -07:00
xtensa Xtensa updates for v6.6 2023-09-07 10:30:17 -07:00
.gitignore
Kconfig