Correct length of buffer and init memory when allocate memory --- src/base/osaf_secutil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/base/osaf_secutil.c b/src/base/osaf_secutil.c index 3d3e32fbd..3a90b0f1c 100644 --- a/src/base/osaf_secutil.c +++ b/src/base/osaf_secutil.c @@ -225,8 +225,8 @@ static char *get_supplementary_group_list(pid_t pid) // Exclude 'Groups:' string and a following tab size_t len = strlen(line_buf) - groups_len - 1; assert(len && "Invalid sumplementary group list"); - group_list = (char *)malloc(len); - strcpy(group_list, line_buf + groups_len + 1); + group_list = (char *)calloc(len, sizeof(char)); + memcpy(group_list, line_buf + groups_len + 1, len); // Remove a character 'new line' at the end of the string group_list[len - 1] = '\0'; -- 2.25.1 _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel