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