]> git.ipfire.org Git - thirdparty/coreutils.git/commit
ls: fix crash with --context
authorPádraig Brady <P@draigBrady.com>
Fri, 17 Jan 2025 17:29:34 +0000 (17:29 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 18 Jan 2025 13:14:29 +0000 (13:14 +0000)
commit915004f403cb25fadb207ddfdbe6a2f43bd44fac
treee5ccb62598e26f396c59584391a4f895b3d7face
parent23fcbeff42f57065f257c9a45604bde99e9bba3a
ls: fix crash with --context

* src/ls.c (main): Flag that we need to stat()
if we're going to get security context (call file_has_aclinfo_cache).
(file_has_aclinfo_cache): Be defensive and only lookup the device
for the file if the stat has been performed.
(has_capability_cache): Likewise.
* tests/ls/selinux-segfault.sh: Add a test case.
* NEWS: Mention the bug fix.
Reported by Bruno Haible.
NEWS
src/ls.c
tests/ls/selinux-segfault.sh