This patch causes that cgexec prints more verbose error messages when an error appears and fixes one possible buffer overflow.
Signed-off-by: Ivana Varekova <[email protected]> Ivana Varekova -------------------------------------------------------- diff -up ./cgexec.c.orig ./cgexec.c --- ./cgexec.c.orig 2009-02-17 10:32:18.000000000 +0100 +++ ./cgexec.c 2009-02-17 13:47:30.000000000 +0100 @@ -93,7 +93,8 @@ int parse_cgroup_data(struct cgroup_data } while (temp); /* Store path to the cgroup */ - strcpy(cdptr[i]->path, pathptr); + strncpy(cdptr[i]->path, FILENAME_MAX, pathptr); + cdptr[i]->path[FILENAME_MAX-1] = '\0'; return 0; } @@ -165,7 +166,8 @@ int main(int argc, char *argv[]) cgroup_list[i]->controllers); if (ret) { fprintf(stderr, - "cgroup change of group failed\n"); + "cgroup change of group failed: %s\n", + cgroup_strerror(ret)); return ret; } } @@ -174,7 +176,8 @@ int main(int argc, char *argv[]) /* Change the cgroup by determining the rules based on euid */ ret = cgroup_change_cgroup_uid_gid(euid, egid, pid); if (ret) { - fprintf(stderr, "cgroup change of group failed\n"); + fprintf(stderr, "cgroup change of group failed: %s\n", + cgroup_strerror(ret)); return ret; } } diff -up ./scripts/init.d/cgconfig.orig ./scripts/init.d/cgconfig ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Libcg-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libcg-devel
