]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
config: cgroup_config_insert_into_mount_table() use strncpy()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 6 Jul 2022 20:09:38 +0000 (14:09 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 6 Jul 2022 20:09:40 +0000 (14:09 -0600)
commita3aab924ab0bffa50b75e82e08160815100c1da1
tree13a72c2a9dda7b5a6ba16ad31c903a9f9419f311
parent0f94ee345a5bb47882e2ec9ea04b3613219e5343
config: cgroup_config_insert_into_mount_table() use strncpy()

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

CID 258282 (#2 of 2): Copy into fixed size buffer (STRING_OVERFLOW)9.
fixed_size_dest: You might overrun the 4096-character fixed-size string
config_mount_table[config_table_index].mount.path by copying mount_point
without checking the length.
parameter_as_source: Note: This defect has an elevated risk because the
source argument is a parameter of the current function

Also, convert config_mount_table[config_table_index].name strcpy to
strncpy.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 4c8e4fd284b4677e5e9bab4f9e13b0866020b499)
src/config.c