From: Donghwa Jeong Date: Thu, 21 Jun 2018 02:06:04 +0000 (+0900) Subject: cgfsng: strncat => strlcat X-Git-Tag: lxc-3.1.0~235^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ebe2fbd2873d2fd52013b6b9c73d5f40ac939cc;p=thirdparty%2Flxc.git cgfsng: strncat => strlcat Signed-off-by: Donghwa Jeong --- 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;