fix strncpy limits in cgroup_config_create_template_group function

Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com>
---

 src/config.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/config.c b/src/config.c
index 06f559b..eacb490 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1612,14 +1612,14 @@ int cgroup_config_create_template_group(struct cgroup 
*cgroup,
                                /* name and controller match template found */
                                /* variables substituted in template */
                                strncpy(buffer, t_cgroup->name,
-                                       FILENAME_MAX);
+                                       FILENAME_MAX-1);
                                strncpy(t_cgroup->name, cgroup->name,
-                                       FILENAME_MAX);
+                                       FILENAME_MAX-1);
 
                                ret = cgroup_create_cgroup(t_cgroup, flags);
 
                                strncpy(t_cgroup->name, buffer,
-                                       FILENAME_MAX);
+                                       FILENAME_MAX-1);
                                if (ret) {
                                        cgroup_dbg("creating group %s, error 
%d\n",
                                        cgroup->name, ret);


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to