Fix a GCC warning about un-truncated strncpy() in
cgroup_process_v2_mnt():
In function 'cgroup_process_v2_mnt',
inlined from 'cgroup_init' at api.c:1387:10:
api.c:1205:9: warning: 'strncpy' specified bound 4096 equals destination size [-Wstringop-truncation]
1205 | strncpy(cg_cgroup_v2_mount_path, ent->mnt_dir, FILENAME_MAX);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
* Save off this mount point. This may be used later to build
* the cg_path.
*/
- strncpy(cg_cgroup_v2_mount_path, ent->mnt_dir, FILENAME_MAX);
+ strncpy(cg_cgroup_v2_mount_path, ent->mnt_dir, FILENAME_MAX-1);
+ cg_cgroup_v2_mount_path[FILENAME_MAX-1] = '\0';
/* determine what v2 controllers are available on this mount */
snprintf(cgroup_controllers_path, FILENAME_MAX, "%s/%s", ent->mnt_dir,
-Subproject commit 3e786fc4c024662cc38c8a39868354c55465f487
+Subproject commit 2aa90061eccb7dbd3d3ce7f6cdf2e087cf8a95a2