]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
src/api.c: fix TOCTOU in cgroup_get_cgroup()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sat, 15 Jul 2023 06:30:02 +0000 (12:00 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 17 Jul 2023 17:25:00 +0000 (11:25 -0600)
commit645ec049d1f39d1f441942c3e8af61f4c5b91460
treed0a0787d81dc685c83c75c775c8d697280e249f1
parent15c6922768abe609dac824d21a9ab997a1780394
src/api.c: fix TOCTOU in cgroup_get_cgroup()

Fix a TOCTOU issue, reported by Coverity tool:

CID 258268 (#1 of 1): Time of check time of use (TOCTOU)28.
fs_check_call: Calling function access to perform check on path.

Coverity gets confused when a char array is re-used for constructing
different paths and complains about TOCTOU for unrelated paths, fix it
by using different char arrays for different path, as a side effect it
also improves the readability of the code.

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