]> git.ipfire.org Git - thirdparty/coreutils.git/commit
unexpand: fix heap overflow
authorPádraig Brady <P@draigBrady.com>
Tue, 28 Apr 2026 19:33:10 +0000 (20:33 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 29 Apr 2026 12:16:43 +0000 (13:16 +0100)
commitb60a159fdc5bfcf9988d3a4cb6f53abe8ad5d35d
treef7f139bd69bacd6525e190584407d3749897a40c
parent00cd91288cce5e781dbc750e85ef00a74bc49def
unexpand: fix heap overflow

* src/unexpand.c (unexpand): Use xinmalloc() to gracefully
handle overflow.  Also use the runtime locale specific MB_CUR_MAX
rather than the worst case MB_LEN_MAX.
* tests/unexpand/mb.sh: Add a test case that fails in a default
glibc build with either MB_CUR_MAX or MB_LEN_MAX.
* NEWS: Mention the bug fix.
Reported by Michał Majchrowicz.
NEWS
src/unexpand.c
tests/unexpand/mb.sh