]> git.ipfire.org Git - thirdparty/util-linux.git/commit
more: fix out-of-bounds write in get_line() on invalid multibyte input
authorlogical-misha <220645577+logical-misha@users.noreply.github.com>
Tue, 21 Jul 2026 04:55:43 +0000 (04:55 +0000)
committerlogical-misha <220645577+logical-misha@users.noreply.github.com>
Tue, 21 Jul 2026 04:55:43 +0000 (04:55 +0000)
commite63ab5126a41c9709d975d29dadf49fde0eefd35
tree08916021bc82bc4962725af0ef69d15a6d2135c7
parent9aed7926e7a2b07c46101761733c00cdc3fe681f
more: fix out-of-bounds write in get_line() on invalid multibyte input

In get_line(), the invalid-multibyte switch arm (case (size_t)-1) writes
*p++ = mbc[0] without the bounds check that its sibling write paths use,
and the "goto process_mbc" back-edge lets it re-run within one loop
iteration, bypassing the loop-head guard. A line that first fills line_buf
with zero-width combining characters (which advance p but not column) and
then supplies an invalid multibyte sequence can step p past the
num_columns*4 + 2 byte allocation -- a heap out-of-bounds write.

Guard the write the same way the sibling path does.

Closes #4494

Signed-off-by: logical-misha <220645577+logical-misha@users.noreply.github.com>
text-utils/more.c