]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api: leave room for NUL in cgroup_get_procs()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sat, 14 Mar 2026 05:04:23 +0000 (10:34 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 19 Mar 2026 18:02:45 +0000 (12:02 -0600)
commit89d64328f6ad6e67b6e2a9279240b3ed90c19ae6
tree236dddeb5ce3534a5bb8a136524e533fa2c95821
parente6671968d4e4bba0ae8e0d6157c4bc3edf9a2c99
api: leave room for NUL in cgroup_get_procs()

Commit 4a851a569689 ("api: Fix unsafe call to strncat in
cgroup_get_procs() and cgroup_get_threads()") tightened several
strncat() callers, but the code building the procs/threads paths
still used the raw remaining buffer size. When the buffer is
already full, strncat() would copy path_sz bytes and overwrite
the terminator. Subtract one from the remaining length before
appending "tasks" or the controller-specific filename so there
is always space for the trailing NUL.

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