]> git.ipfire.org Git - thirdparty/util-linux.git/commit
column: fix missing out-of-bounds check in table reordering
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Sat, 25 Apr 2026 21:01:06 +0000 (17:01 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Wed, 29 Apr 2026 10:57:25 +0000 (06:57 -0400)
commit6f585e902be542fc36e4e7643d4fca39e4f2fbe9
tree805095caa2474f55567216110bc40ea724cd415f
parent8526abb7312b4ce56bb644434e1893dad03cdabf
column: fix missing out-of-bounds check in table reordering

When the --table-order option is used we allocate memory on
the heap for the actual amount of columns we receive from
the input, and later store the wanted column struct objects,
specified in the --table-order list, in that memory space.

We do this by iterating over the order list and incrementing
the heap pointer with a counter variable. This leads to a
buffer overflow when the amount of input columns is smaller
than the amount of columns specified in the table order list.

To prevent this we iterate over the order list for as long as
the counter is smaller than the number of input columns.

Closes: #4281
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
text-utils/column.c