]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
cgsnapshot: Fix possible non-null-terminated array
authorTom Hromatka <tom.hromatka@oracle.com>
Mon, 3 Jul 2023 19:07:41 +0000 (13:07 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 5 Jul 2023 15:03:26 +0000 (09:03 -0600)
commit3124474303cbed17455b0d5300feb34b1317b045
tree357fd9e1878ee5e40d446b0d43ccc3406e04809c
parentc48925b5ebba1767b80803bb51b2abf4836a0660
cgsnapshot: Fix possible non-null-terminated array

Coverity flagged a code path where the controllers[][] structure in
parse_controllers() may not have a '\0' string as its last entry.
This would break the logic in is_ctlr_on_list().

The function may iterate past the end of the buffer looking for
a null terminator.

In parse_controllers: A character buffer that has not been null
terminated is passed to a function expecting a null terminated
string (CWE-170)

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