]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api.c: search_and_append_mnt_path() use strncpy()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 2 Jun 2022 16:04:32 +0000 (10:04 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 2 Jun 2022 16:04:35 +0000 (10:04 -0600)
commitaa6d6301581f86759291b65704e91a31cb100cb4
tree5aa3aa16da0512f685b4def6fbc53f636260b3ca
parentbcdc80a46273705b846a641f65d171540137a7cf
api.c: search_and_append_mnt_path() use strncpy()

Fix copy into fixed size buffer warning, reported by Coverity tool:

CID 258279 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW).
fixed_size_dest: You might overrun the 4096-character fixed-size string
mnt_point->path by copying path without checking the length.
10. parameter_as_source: Note: This defect has an elevated risk
because the source argument is a parameter of the current function.

fix this issue by using strnpy(), in place of strcpy().

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