]> git.ipfire.org Git - thirdparty/lxc.git/commit
make setproctitle()'s /proc/pid/stat parsing safe 4299/head
authorTycho Andersen <tycho@tycho.pizza>
Mon, 10 Apr 2023 23:12:24 +0000 (17:12 -0600)
committerTycho Andersen <tycho@tycho.pizza>
Mon, 10 Apr 2023 23:20:47 +0000 (17:20 -0600)
commitf7f15b20a301d280403675ace11cdb53e42a909d
tree3956d1ae92b883e60b11427913597ff634d43bd8
parent52326514c64b6622368475307d7a7a76c3ee3780
make setproctitle()'s /proc/pid/stat parsing safe

it turns out that our parsing of /proc/pid/stat was not safe in general
(though probably safe for lxc, since our executable names do not contain
spaces).

Let's fix this by looking backwards through the file for ), and then
continuing on from there.

This was reported to me by Solar Designer, who pointed me to this thread:
https://twitter.com/solardiz/status/1634204168545001473

Indeed, this is a lot of tap dancing to work around the kernel's 16
character executable limit. Perhaps I'll send a kernel patch to raise that
limit next.

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
src/lxc/initutils.c