From 3ebe2fbd2873d2fd52013b6b9c73d5f40ac939cc Mon Sep 17 00:00:00 2001 From: Donghwa Jeong Date: Thu, 21 Jun 2018 11:06:04 +0900 Subject: [PATCH] cgfsng: strncat => strlcat Signed-off-by: Donghwa Jeong --- src/lxc/cgroups/cgfsng.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 2540bd811..fedb9a063 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -62,6 +62,10 @@ #include "include/strlcpy.h" #endif +#ifndef HAVE_STRLCAT +#include "include/strlcat.h" +#endif + lxc_log_define(lxc_cgfsng, lxc); static void free_string_list(char **clist) @@ -1205,11 +1209,11 @@ static bool cg_unified_create_cgroup(struct hierarchy *h, char *cgname) if (h->controllers[0] == *it) add_controllers[0] = '\0'; - strncat(add_controllers, "+", 1); - strncat(add_controllers, *it, strlen(*it)); + (void)strlcat(add_controllers, "+", full_len + 1); + (void)strlcat(add_controllers, *it, full_len + 1); if ((it + 1) && *(it + 1)) - strncat(add_controllers, " ", 1); + (void)strlcat(add_controllers, " ", full_len + 1); } parts = lxc_string_split(cgname, '/'); @@ -1951,7 +1955,7 @@ static int __cg_unified_attach(const struct hierarchy *h, const char *name, if (ret < 0 && errno != EEXIST) goto on_error; - strncat(full_path, "/cgroup.procs", strlen("/cgroup.procs")); + (void)strlcat(full_path, "/cgroup.procs", len + 1); ret = lxc_write_to_file(full_path, pidstr, len, false, 0666); if (ret == 0) goto on_success; -- 2.47.3