summaryrefslogtreecommitdiffstats
path: root/pw
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2012-12-26 23:14:33 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2012-12-26 23:14:33 +0000
commit9ee906bbd3ca844c465c6f1056ac025ccca948e3 (patch)
tree7d4028413c4513c798913dfd4fc59ca7c86caf3d /pw
parente384eae800c0d663ba8b68103771103d8e78c0f6 (diff)
downloadpw-darwin-9ee906bbd3ca844c465c6f1056ac025ccca948e3.tar.gz
pw-darwin-9ee906bbd3ca844c465c6f1056ac025ccca948e3.tar.zst
pw-darwin-9ee906bbd3ca844c465c6f1056ac025ccca948e3.zip
Fix off-by-one error in memory allocation: j entries, one new and a null
terminator is j + 2. Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
Diffstat (limited to 'pw')
-rw-r--r--pw/pw_user.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c
index 7df6b85..43119ed 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -756,7 +756,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
if (grp->gr_mem[j] != NULL) /* user already member of group */
continue;
- members = malloc(sizeof(char *) * (j + 1));
+ members = malloc(sizeof(char *) * (j + 2));
for (j = 0; grp->gr_mem[j] != NULL; j++)
members[j] = grp->gr_mem[j];