Files
linux-stable-mirror/lib
Kees Cook 079a028d63 string: Remove strncpy() from the kernel
strncpy() has been a persistent source of bugs due to its ambiguous
intended usage and frequently counter-intuitive semantics: it may not
NUL-terminate the destination, and it unconditionally zero-pads to the
full length, which isn't always needed. All former callers have been
migrated[1] to:

  - strscpy()        for NUL-terminated destinations
  - strscpy_pad()    for NUL-terminated destinations needing zero-padding
  - strtomem_pad()   for non-NUL-terminated fixed-width fields
  - memcpy_and_pad() for bounded copies with explicit padding
  - memcpy()         for known-length copies

Remove the generic implementation, its declaration, the FORTIFY_SOURCE
wrapper, and associated tests.

Link: https://github.com/KSPP/linux/issues/90 [1]
Signed-off-by: Kees Cook <kees@kernel.org>
2026-06-18 16:39:31 -07:00
..
2026-03-05 22:16:08 -05:00
2026-04-02 23:36:16 -07:00
2026-01-11 06:09:11 -10:00
2026-02-27 16:40:16 +01:00
2026-03-24 13:39:53 -04:00
2026-04-18 00:10:48 -07:00