From 6f9e060eaafec4d7157f90f32e8d2d580fd73a71 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Wed, 26 Dec 2012 23:16:24 +0000 Subject: [PATCH] Simplify copying of group members by using memcpy Submitted by: Christoph Mallon --- pw/pw_user.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pw/pw_user.c b/pw/pw_user.c index 43119ed..74c1ef9 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -757,8 +757,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) continue; members = malloc(sizeof(char *) * (j + 2)); - for (j = 0; grp->gr_mem[j] != NULL; j++) - members[j] = grp->gr_mem[j]; + memcpy(members, grp->gr_mem, j * sizeof(*members)); members[j] = pwd->pw_name; members[j+1] = NULL; -- 2.47.1