]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgxget: fix segfault in free path
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 14 Apr 2023 15:30:01 +0000 (15:30 +0000)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 17 Apr 2023 17:58:54 +0000 (11:58 -0600)
commita1299d6cd01fbff653a3fe919a67ea86483a054e
tree0007a2c7cb5f974b5f51bd3cdb00bc2aa05fe2bb
parentce809ea7519b2741edbb823618fdf6796de1f4d0
tools/cgxget: fix segfault in free path

cgxget tool crashes, when passing basic operations such as multiple
cgroups as arguments or invalid parameters, it turns out the address of
struct cgroup passed for cgroup_free() has been invalid.

$ sudo ./src/tools/cgxget -1 -r cpu.shares a b
Segmentation fault (core dumped)

$ sudo ./src/tools/cgxget -1 cpu.shares a b
Segmentation fault (core dumped)

this patch fixes it by passing the right address of the struct cgroup[]
to cgroup_free().

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgxget.c