Files
coreutils/src
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
..
2025-02-14 13:13:08 -08:00
2025-02-02 22:09:52 -08:00
2025-02-20 12:56:20 +00:00
2023-12-27 19:51:00 +00: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-01 14:05:59 +01:00
2025-02-20 12:56:20 +00:00
2025-02-20 12:56:20 +00:00
2025-05-28 12:49:17 -07:00
2025-02-02 22:09:52 -08:00
2025-02-18 20:10:19 -08:00
2005-07-18 07:52:37 +00:00
2025-02-20 12:56:20 +00:00
2025-02-20 12:56:20 +00:00
2025-02-02 22:09:52 -08:00
2025-02-20 12:56:20 +00:00
2025-05-28 12:49:17 -07:00
2025-05-12 01:28:48 -07:00
…
…
…
2025-02-20 12:56:20 +00:00
2025-02-02 22:09:52 -08:00
2025-06-23 13:16:32 +01:00
2025-06-22 17:00:02 +01:00
2025-02-02 22:09:52 -08:00
2025-01-15 17:42:55 +00:00
2025-02-02 22:09:52 -08: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-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