]> git.ipfire.org Git - thirdparty/systemd.git/commit
journald: prevent segfault on empty attr/current
authorSpace Meyer <spm@google.com>
Wed, 7 Dec 2022 13:11:30 +0000 (14:11 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 8 Dec 2022 00:00:25 +0000 (01:00 +0100)
commitff868eaadecde2568d1e08a375ec8a3b327984fa
tree38692117efc6af63a85a6dbf98e97eafea57b06e
parent2d18605ca81b50594cf307e8f968edd429205bc3
journald: prevent segfault on empty attr/current

getpidcon() might set con to NULL, even when it returned a 0 return
code[0]. The subsequent strlen(con) will then cause a segfault.

Alternatively the behaviour could also be changed in getpidcon. I
don't know whether the libselinux folks are comitted to the current
behaviour, but the getpidcon man page doesn't really make it obvious
this case could happen.

[0] https://github.com/SELinuxProject/selinux/blob/fb7f35495fbad468d6efa76c5fed727659903038/libselinux/src/procattr.c#L155-L158
src/journal/journald-context.c