diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2012-12-26 23:14:33 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2012-12-26 23:14:33 +0000 |
commit | 9ee906bbd3ca844c465c6f1056ac025ccca948e3 (patch) | |
tree | 7d4028413c4513c798913dfd4fc59ca7c86caf3d /pw | |
parent | e384eae800c0d663ba8b68103771103d8e78c0f6 (diff) | |
download | pw-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.c | 2 |
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]; |