libcgroup/libcgroup-0.40.rc1-coverity.patch
DistroBaker a6f4e95faa Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/libcgroup.git#952c4be5e80b7d48a0eb11efdfd3d32157ac6fce
2020-10-30 15:06:34 +01:00

80 lines
2.4 KiB
Diff

diff --git a/src/config.c b/src/config.c
index 3ffa263..b5d51b3 100644
--- a/src/config.c
+++ b/src/config.c
@@ -326,7 +326,7 @@ int config_group_task_perm(char *perm_type, char *value, int flag)
long val = atoi(value);
char buffer[CGROUP_BUFFER_LEN];
struct cgroup *config_cgroup;
- int table_index;
+ int table_index, ret;
switch (flag) {
case CGROUP:
@@ -370,10 +370,10 @@ int config_group_task_perm(char *perm_type, char *value, int flag)
if (!group)
goto group_task_error;
- getgrnam_r(value, group, buffer,
+ ret = getgrnam_r(value, group, buffer,
CGROUP_BUFFER_LEN, &group_buffer);
- if (group_buffer == NULL) {
+ if (ret != 0 || group_buffer == NULL) {
free(group);
goto group_task_error;
}
@@ -439,7 +439,7 @@ int config_group_admin_perm(char *perm_type, char *value, int flag)
struct cgroup *config_cgroup;
long val = atoi(value);
char buffer[CGROUP_BUFFER_LEN];
- int table_index;
+ int table_index, ret;
switch (flag) {
case CGROUP:
@@ -482,10 +482,10 @@ int config_group_admin_perm(char *perm_type, char *value, int flag)
if (!group)
goto admin_error;
- getgrnam_r(value, group, buffer,
+ ret = getgrnam_r(value, group, buffer,
CGROUP_BUFFER_LEN, &group_buffer);
- if (group_buffer == NULL) {
+ if (ret != 0 || group_buffer == NULL) {
free(group);
goto admin_error;
}
diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c
index 4cef53e..90920d1 100644
--- a/src/daemon/cgrulesengd.c
+++ b/src/daemon/cgrulesengd.c
@@ -654,7 +654,7 @@ close:
static int cgre_create_netlink_socket_process_msg(void)
{
- int sk_nl = 0, sk_unix = 0, sk_max;
+ int sk_nl = -1, sk_unix = -1, sk_max;
struct sockaddr_nl my_nla;
char buff[BUFF_SIZE];
int rc = -1;
diff --git a/src/tools/lscgroup.c b/src/tools/lscgroup.c
index bfb1724..d15a0c2 100644
--- a/src/tools/lscgroup.c
+++ b/src/tools/lscgroup.c
@@ -96,11 +96,11 @@ static int display_controller_data(char *input_path, char *controller, char *nam
if (ret != 0)
return ret;
- strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX);
+ strncpy(cgroup_dir_path, info.full_path, FILENAME_MAX - 1);
/* remove problematic '/' characters from cgroup directory path*/
trim_filepath(cgroup_dir_path);
- strncpy(input_dir_path, input_path, FILENAME_MAX);
+ strncpy(input_dir_path, input_path, FILENAME_MAX - 1);
/* remove problematic '/' characters from input directory path*/
trim_filepath(input_dir_path);