]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
Simplify copying of group members by using memcpy
authorBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 26 Dec 2012 23:16:24 +0000 (23:16 +0000)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 26 Dec 2012 23:16:24 +0000 (23:16 +0000)
Submitted by: Christoph Mallon <christoph.mallon@gmx.de>

pw/pw_user.c

index 43119ed82a3bf9a8293df58e7ea34d7f1abdbaf2..74c1ef916e246e8a72f48315aa92507fcc634cf3 100644 (file)
@@ -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;