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-05-28 13:14:23 -07:00
2026-06-11 12:57:49 -07:00
2026-02-21 17:09:51 -08:00
2026-06-09 16:00:11 +02:00
2026-06-16 16:33:57 +05:30
2026-04-16 20:11:56 -07:00
2026-02-21 17:09:51 -08:00
2026-05-28 13:14:21 -07:00
2025-12-05 16:26:57 -08:00
2026-02-21 17:09:51 -08:00
2026-06-18 16:39:31 -07:00
2026-06-18 16:39:31 -07:00
2026-06-15 13:57:13 +05:30
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-04-18 00:10:50 -07:00
2026-02-21 20:03:00 -08:00
2026-03-05 22:16:08 -05:00
2025-11-20 14:03:44 -08:00
2026-03-27 21:19:48 -07:00
2026-04-01 20:03:07 -04:00
2026-05-12 09:44:31 +09:00
2026-02-21 01:02:28 -08:00
2026-05-14 10:50:00 -06:00
2026-01-20 19:44:15 -08:00
2026-02-05 14:10:00 -08:00
2025-11-21 18:42:01 +00:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-06-13 08:23:36 -07:00
2026-01-05 16:43:33 +01:00
2026-03-27 21:19:43 -07:00
2026-02-22 12:05:31 -08:00
2026-02-21 01:02:28 -08:00
2025-10-05 10:48:33 -07:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-03-23 13:33:51 -04:00
2026-03-23 13:33:51 -04:00
2026-01-26 19:03:46 -08:00
2026-03-27 21:19:45 -07:00
2026-02-21 17:09:51 -08:00
2026-01-20 19:44:19 -08:00
2025-11-06 11:51:04 -05:00
2026-02-21 01:02:28 -08:00
2026-03-27 21:19:42 -07:00
2026-02-21 17:09:51 -08:00
2025-10-14 14:45:22 -07:00
2026-05-21 09:32:47 +02:00
2026-04-02 23:36:16 -07:00
2026-06-15 14:31:58 +05:30
2025-10-27 16:22:02 -07:00
2026-01-07 12:16:03 -08:00
2026-01-26 19:07:09 -08:00
2026-04-09 14:36:52 +02:00
2026-04-09 14:36:52 +02:00
2026-01-26 19:07:10 -08:00
2026-03-30 16:58:33 +02:00
2026-04-02 23:36:22 -07:00
2026-06-03 11:38:47 +02:00
2026-01-05 16:43:33 +01:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-04-16 20:11:56 -07:00
2026-04-27 05:54:25 -07:00
2026-02-22 08:26:33 -08:00
2026-02-12 15:45:57 -08:00
2026-02-21 01:02:28 -08:00
2026-02-21 17:09:51 -08:00
2026-04-02 23:36:24 -07:00
2026-02-21 01:02:28 -08:00
2026-01-11 06:09:11 -10:00
2025-11-20 14:03:45 -08:00
2026-02-21 17:09:51 -08:00
2026-02-27 16:40:16 +01:00
2026-02-21 01:02:28 -08:00
2026-06-17 09:18:14 +01:00
2026-04-02 23:36:23 -07:00
2026-02-21 01:02:28 -08:00
2026-02-21 17:09:51 -08:00
2026-05-13 10:54:08 -07:00
2026-06-18 16:39:31 -07:00
2025-11-18 15:27:35 +01:00
2025-11-18 15:27:35 +01:00
2025-11-20 14:03:43 -08:00
2026-03-24 13:39:53 -04:00
2026-04-20 17:57:36 -07:00
2026-05-28 12:20:19 +02:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2025-11-24 15:08:48 -08:00
2026-04-18 00:10:52 -07:00
2026-04-18 00:10:48 -07:00
2026-04-27 05:54:25 -07:00
2026-02-21 17:09:51 -08:00
2026-06-03 18:20:43 +02:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2026-06-05 08:00:07 -07:00
2026-02-21 17:09:51 -08:00
2026-04-03 07:14:24 -10:00
2026-02-27 16:40:16 +01:00
2026-03-27 21:19:44 -07:00
2026-03-27 21:19:44 -07:00
2025-11-12 10:00:16 -08:00
2026-03-27 21:19:41 -07:00
2026-05-21 09:32:46 +02:00
2025-11-12 10:00:17 -08:00