]> git.ipfire.org Git - thirdparty/coreutils.git/commit
unexpand: fix heap buffer overflow with --tabs=[+/]NUM
authorPádraig Brady <P@draigBrady.com>
Thu, 2 Oct 2025 11:24:20 +0000 (12:24 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 2 Oct 2025 14:26:02 +0000 (15:26 +0100)
commit75e3888bd3e6787f066f23b3c606d0e8f49fa5cc
treef256f07ee905fdf0496b1184e6bda1eda90065e0
parent58ea3574e67dee147a4305c0dda99c80f4b9d10c
unexpand: fix heap buffer overflow with --tabs=[+/]NUM

This avoids CWE-122: Heap-based Buffer Overflow
where we could write blank characters beyond
the allocated heap buffer.

* src/expand-common.c (set_max_column_width): Refactor function from ...
(add_tab_stop): ... here.
(set_extend_size): Call new function.
(set_increment_size): Likewise.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/79555
NEWS
src/expand-common.c
tests/misc/unexpand.pl