]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgxget: fix TOCTOU in fill_empty_controller()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 14 Jul 2023 06:13:38 +0000 (11:43 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 17 Jul 2023 17:22:46 +0000 (11:22 -0600)
commit15c6922768abe609dac824d21a9ab997a1780394
treede64e98f2e88da2cb0336eb4058867379e920c5d
parentb63f15380dfd65bf17fa9164cb80052ee24bafd7
tools/cgxget: fix TOCTOU in fill_empty_controller()

Fix a TOCTOU issue, reported by Coverity tool:

CID 258277 (#1 of 1): Time of check time of use (TOCTOU)13.
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/tools/cgxget.c