]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libsmartcols: fix SEGV in filter_compile_param()
authorKarel Zak <kzak@redhat.com>
Mon, 22 Jun 2026 08:41:51 +0000 (10:41 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 24 Jun 2026 09:20:15 +0000 (11:20 +0200)
commit2857d9ce932730fa2d5dd3c1aeedf73cf38bdb06
tree2fd48ae093951e8d2d6d783172441807a9ca672e
parentde5ac092b57e812ad3c4ef7f733971f6f159a9c7
libsmartcols: fix SEGV in filter_compile_param()

The val union in filter_param can hold different types (str, num, fnum,
boolean). When a non-string param (e.g. a number) is used as a regex
operand, the numeric value gets reinterpreted as a pointer through
val.str. A small number like 2 becomes pointer 0x2, which passes the
existing NULL check but crashes in regcomp().

Add a type check to reject non-string params before accessing val.str.

Addresses: https://github.com/util-linux/util-linux/pull/4430
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/filter-param.c