1 diff --git a/src/config.c b/src/config.c
2 index 3ffa263..b5d51b3 100644
5 @@ -326,7 +326,7 @@ int config_group_task_perm(char *perm_type, char *value, int flag)
6 long val = atoi(value);
7 char buffer[CGROUP_BUFFER_LEN];
8 struct cgroup *config_cgroup;
10 + int table_index, ret;
14 @@ -370,10 +370,10 @@ int config_group_task_perm(char *perm_type, char *value, int flag)
16 goto group_task_error;
18 - getgrnam_r(value, group, buffer,
19 + ret = getgrnam_r(value, group, buffer,
20 CGROUP_BUFFER_LEN, &group_buffer);
22 - if (group_buffer == NULL) {
23 + if (ret != 0 || group_buffer == NULL) {
25 goto group_task_error;
27 @@ -439,7 +439,7 @@ int config_group_admin_perm(char *perm_type, char *value, int flag)
28 struct cgroup *config_cgroup;
29 long val = atoi(value);
30 char buffer[CGROUP_BUFFER_LEN];
32 + int table_index, ret;
36 @@ -482,10 +482,10 @@ int config_group_admin_perm(char *perm_type, char *value, int flag)
40 - getgrnam_r(value, group, buffer,
41 + ret = getgrnam_r(value, group, buffer,
42 CGROUP_BUFFER_LEN, &group_buffer);
44 - if (group_buffer == NULL) {
45 + if (ret != 0 || group_buffer == NULL) {
49 diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c
50 index 4cef53e..90920d1 100644
51 --- a/src/daemon/cgrulesengd.c
52 +++ b/src/daemon/cgrulesengd.c
53 @@ -654,7 +654,7 @@ close:
55 static int cgre_create_netlink_socket_process_msg(void)
57 - int sk_nl = 0, sk_unix = 0, sk_max;
58 + int sk_nl = -1, sk_unix = -1, sk_max;
59 struct sockaddr_nl my_nla;
62 diff --git a/src/tools/lscgroup.c b/src/tools/lscgroup.c
63 index bfb1724..d15a0c2 100644
64 --- a/src/tools/lscgroup.c
65 +++ b/src/tools/lscgroup.c
66 @@ -96,11 +96,11 @@ static int display_controller_data(char *input_path, char *controller, char *nam
70 - strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX);
71 + strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX - 1);
72 /* remove problematic '/' characters from cgroup directory path*/
73 trim_filepath(cgroup_dir_path);
75 - strncpy(input_dir_path, input_path, FILENAME_MAX);
76 + strncpy(input_dir_path, input_path, FILENAME_MAX - 1);
78 /* remove problematic '/' characters from input directory path*/
79 trim_filepath(input_dir_path);