Pádraig Brady
44809c3379
od: fix various off-by-one issues with --strings with -N
...
* src/od.c (dump_strings): There are three related issues here
due to not accounting for the terminating NUL char appropriately.
1. Ensure BUF always has enough space for the terminating NUL.
This avoids CWE-122: Heap-based Buffer Overflow,
where we wrote a single NUL byte directly after the allocated buffer.
I.e., there should be no buffer overflow with:
printf '%100s' | od -N100 -S1
2. Ensure we support -S == -N (END_OFFSET - STRING_MIN == ADDRESS):
I.e., there should be output with:
printf '%100s' | od -N10 -S10
3. Ensure we always output a valid address by ensuring
the ADDRESS and I variables are kept in sync.
I.e., this should output address 0000000 not 1777777777777777777777:
printf '%100s' | od -N10 -S1
As well as fixing these we simplify by using a single loop
to read the data, rather than two.
* doc/coreutils.texi (od invocation): Clarify that -N
implicitly NUL terminates strings.
* tests/od/od-N.sh: Add test cases.
* NEWS: Mention the bug fixes.
Fixes https://bugs.gnu.org/78880
2025-06-24 16:21:00 +01:00
..
2023-10-30 00:58:03 -07:00
2025-06-18 14:20:17 +01:00
2025-01-01 09:33:08 +00:00
2025-05-09 15:57:13 -07:00
2025-02-14 13:13:08 -08:00
2025-01-01 09:33:08 +00:00
2025-02-02 22:09:52 -08:00
2023-12-27 19:51:00 +00:00
2023-12-27 19:51:00 +00:00
2025-02-20 12:56:20 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2023-12-27 19:51:00 +00:00
2025-06-03 23:11:44 +01:00
2025-02-18 20:10:19 -08:00
2025-02-18 20:10:19 -08:00
2025-02-18 20:10:19 -08:00
2025-02-18 20:10:19 -08:00
2025-05-18 09:49:29 +01:00
2025-02-20 12:56:16 +00:00
2025-06-22 11:33:11 +01:00
2025-05-01 14:05:59 +01:00
2025-01-07 17:28:49 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-02-20 12:56:20 +00:00
2022-01-31 12:07:39 -08:00
2025-06-07 18:53:43 +01:00
2025-02-20 12:56:20 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-05-28 12:49:17 -07:00
2025-02-02 22:09:52 -08:00
2025-05-09 15:57:13 -07:00
2025-01-01 09:33:08 +00:00
2025-03-15 12:57:53 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-02-18 20:10:19 -08:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-04-04 21:14:29 +01:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-05-18 10:37:35 +01:00
2005-07-18 07:52:37 +00:00
2025-02-20 12:56:20 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-02-20 12:56:20 +00:00
2021-10-31 22:36:46 -07:00
2025-01-01 09:33:08 +00:00
2025-02-20 12:56:20 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-02-02 22:09:52 -08:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-03-22 12:35:15 +00:00
2025-01-07 17:28:49 +00:00
2025-01-01 09:33:08 +00:00
2025-02-20 12:56:20 +00:00
2023-03-13 21:26:21 +00:00
2025-06-22 11:33:11 +01:00
2025-01-01 09:33:08 +00:00
2025-05-24 13:02:31 -07:00
2025-01-01 09:33:08 +00:00
2025-05-28 12:49:17 -07:00
2025-06-23 22:13:51 +01:00
2025-01-01 09:33:08 +00:00
2025-05-12 01:28:48 -07:00
2025-06-22 11:33:11 +01:00
2012-01-09 21:51:59 +01:00
2025-05-17 21:49:22 -07:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-07 17:28:49 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2024-05-05 17:50:28 +01:00
2025-06-24 16:21:00 +01:00
2025-02-20 12:56:20 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-06-03 23:11:44 +01:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-06-22 11:33:11 +01:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-05-12 01:28:48 -07:00
2025-01-01 09:33:08 +00:00
2025-06-22 11:33:11 +01:00
2025-01-01 09:33:08 +00:00
2025-02-20 12:56:20 +00:00
2024-05-05 17:50:14 +01:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-04-07 00:59:27 -07:00
2025-06-22 11:33:11 +01:00
2025-06-23 22:56:36 +01:00
2025-02-02 22:09:52 -08:00
2025-05-09 15:57:13 -07:00
2025-01-01 09:33:08 +00:00
2025-06-23 13:16:32 +01:00
2025-06-22 17:00:02 +01:00
2025-05-09 15:57:13 -07:00
2023-02-06 13:09:40 +00:00
2025-02-02 22:09:52 -08:00
2025-05-15 09:00:18 -07:00
2025-01-01 09:33:08 +00:00
2025-01-15 17:42:55 +00:00
2025-04-07 00:59:27 -07:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2023-07-18 23:10:40 +01:00
2025-06-18 14:20:17 +01:00
2025-01-01 09:33:08 +00:00
2025-06-03 23:11:44 +01:00
2025-01-01 09:33:08 +00:00
2025-02-02 22:09:52 -08:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-06-21 10:59:46 +01:00
2007-07-10 19:00:00 +02:00
2007-07-10 19:00:00 +02:00
2025-01-01 09:33:08 +00:00
2012-01-09 21:51:59 +01:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-01-01 09:33:08 +00:00
2025-02-20 12:56:20 +00:00
2025-02-02 22:09:52 -08:00
2023-09-23 17:07:52 -07:00
2025-02-24 15:33:17 +00:00
2025-01-01 09:33:08 +00:00
2025-01-15 22:16:30 +00:00