diff options
author | bapt <bapt@FreeBSD.org> | 2012-12-26 23:14:33 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2012-12-26 23:14:33 +0000 |
commit | bc1ecc20ad2778adce1a14f4dd7df9218ae0ee5b (patch) | |
tree | 334cde932f6929a1a60b9d5761124f3eb6d9a588 /usr.sbin/pw | |
parent | 6b14b2464dcc46d77878ed9e0f31c812c613343f (diff) | |
download | FreeBSD-src-bc1ecc20ad2778adce1a14f4dd7df9218ae0ee5b.zip FreeBSD-src-bc1ecc20ad2778adce1a14f4dd7df9218ae0ee5b.tar.gz |
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 'usr.sbin/pw')
-rw-r--r-- | usr.sbin/pw/pw_user.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 7df6b85..43119ed 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/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]; |