]> git.pld-linux.org Git - packages/libcgroup.git/blob - libcgroup-0.40.rc1-coverity.patch
439abf177ad8765ce44332fce95d0cc7742a1ec0
[packages/libcgroup.git] / libcgroup-0.40.rc1-coverity.patch
1 diff -up libcgroup-0.41/src/api.c.coverity libcgroup-0.41/src/api.c
2 --- libcgroup-0.41/src/api.c.coverity   2014-01-13 20:52:49.853838149 +0100
3 +++ libcgroup-0.41/src/api.c    2014-01-13 20:52:49.854838142 +0100
4 @@ -2791,7 +2791,6 @@ static int cgroup_create_template_group(
5         if (group_name == NULL) {
6                 ret = ECGOTHER;
7                 last_errno = errno;
8 -               free(template_name);
9                 goto end;
10         }
11  
12 diff -up libcgroup-0.41/src/config.c.coverity libcgroup-0.41/src/config.c
13 --- libcgroup-0.41/src/config.c.coverity        2014-01-13 15:05:56.000000000 +0100
14 +++ libcgroup-0.41/src/config.c 2014-01-13 20:52:49.854838142 +0100
15 @@ -323,7 +323,7 @@ int config_group_task_perm(char *perm_ty
16         long val = atoi(value);
17         char buffer[CGROUP_BUFFER_LEN];
18         struct cgroup *config_cgroup;
19 -       int table_index;
20 +       int table_index, ret;
21  
22         switch (flag) {
23         case CGROUP:
24 @@ -367,10 +367,10 @@ int config_group_task_perm(char *perm_ty
25                         if (!group)
26                                 goto group_task_error;
27  
28 -                       getgrnam_r(value, group, buffer,
29 +                       ret = getgrnam_r(value, group, buffer,
30                                         CGROUP_BUFFER_LEN, &group_buffer);
31  
32 -                       if (group_buffer == NULL) {
33 +                       if (ret != 0 || group_buffer == NULL) {
34                                 free(group);
35                                 goto group_task_error;
36                         }
37 @@ -436,7 +436,7 @@ int config_group_admin_perm(char *perm_t
38         struct cgroup *config_cgroup;
39         long val = atoi(value);
40         char buffer[CGROUP_BUFFER_LEN];
41 -       int table_index;
42 +       int table_index, ret;
43  
44         switch (flag) {
45         case CGROUP:
46 @@ -479,10 +479,10 @@ int config_group_admin_perm(char *perm_t
47                         if (!group)
48                                 goto admin_error;
49  
50 -                       getgrnam_r(value, group, buffer,
51 +                       ret = getgrnam_r(value, group, buffer,
52                                         CGROUP_BUFFER_LEN, &group_buffer);
53  
54 -                       if (group_buffer == NULL) {
55 +                       if (ret != 0 || group_buffer == NULL) {
56                                 free(group);
57                                 goto admin_error;
58                         }
59 diff -up libcgroup-0.41/src/daemon/cgrulesengd.c.coverity libcgroup-0.41/src/daemon/cgrulesengd.c
60 --- libcgroup-0.41/src/daemon/cgrulesengd.c.coverity    2014-01-13 15:05:56.000000000 +0100
61 +++ libcgroup-0.41/src/daemon/cgrulesengd.c     2014-01-13 20:52:49.854838142 +0100
62 @@ -646,7 +646,7 @@ close:
63  
64  static int cgre_create_netlink_socket_process_msg(void)
65  {
66 -       int sk_nl = 0, sk_unix = 0, sk_max;
67 +       int sk_nl = -1, sk_unix = -1, sk_max;
68         struct sockaddr_nl my_nla;
69         char buff[BUFF_SIZE];
70         int rc = -1;
71 @@ -784,9 +784,9 @@ static int cgre_create_netlink_socket_pr
72         }
73  
74  close_and_exit:
75 -       if (sk_nl > 0)
76 +       if (sk_nl > -1)
77                 close(sk_nl);
78 -       if (sk_unix > 0)
79 +       if (sk_unix > -1)
80                 close(sk_unix);
81         return rc;
82  }
83 diff -upr libcgroup-0.40.rc1.orig/src/tools/lscgroup.c libcgroup-0.40.rc1/src/tools/lscgroup.c
84 --- libcgroup-0.40.rc1.orig/src/tools/lscgroup.c        2013-05-21 15:36:04.000000000 +0200
85 +++ libcgroup-0.40.rc1/src/tools/lscgroup.c     2013-11-04 14:26:53.400473523 +0100
86 @@ -97,11 +97,11 @@ static int display_controller_data(char
87         if (ret != 0)
88                 return ret;
89  
90 -       strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX);
91 +       strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX - 1);
92         /* remove problematic  '/' characters from cgroup directory path*/
93         trim_filepath(cgroup_dir_path);
94  
95 -       strncpy(input_dir_path, input_path, FILENAME_MAX);
96 +       strncpy(input_dir_path, input_path, FILENAME_MAX - 1);
97  
98         /* remove problematic  '/' characters from input directory path*/
99         trim_filepath(input_dir_path);
This page took 0.023014 seconds and 2 git commands to generate.