]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api.c: fix string termination in cgroup_get_procname_from_procfs()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 20 Jul 2022 17:15:27 +0000 (11:15 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 20 Jul 2022 17:15:31 +0000 (11:15 -0600)
commit422c0300583a7b450838e4936ba0d51584354831
tree0d8f72f6975429e35a389663ccb1a49a1613fa02
parent239b3c4154e8129b62db0f1743f3e947e6932871
api.c: fix string termination in cgroup_get_procname_from_procfs()

Fix non-terminated string warning, reported by Coverity tool:

CID 258273 (#2 of 2): String not null terminated (STRING_NULL)6.
string_null: Passing unterminated string buf to strdup, which expects a
null-terminated string.

use snprintf() instead of sprintf(), to string terminate
cgroup_get_procname_from_procfs().

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