]> git.ipfire.org Git - thirdparty/lxc.git/commit
make setproctitle()'s /proc/pid/stat parsing safe
authorTycho Andersen <tycho@tycho.pizza>
Mon, 10 Apr 2023 23:12:24 +0000 (17:12 -0600)
committerStéphane Graber <stgraber@stgraber.org>
Tue, 25 Jul 2023 16:27:58 +0000 (12:27 -0400)
commit709d42691dfcf6bfbf8206dcda1d574936d9d44c
tree18db4f47d59843aeb5a3afa7d36b04057d9bbdba
parentb183d437b4b4af9ecdce0505577c39026be0a985
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