diff options
author | 2012-12-26 23:14:33 +0000 | |
---|---|---|
committer | 2012-12-26 23:14:33 +0000 | |
commit | f5a04a9f49ff5a1dd493c135efbf0e9dde2c97d1 (patch) | |
tree | c092f1cc7d4dffbfb4e08bb152856486913a858e /pw | |
parent | e8d40660fcad4c4bae334a2a7592616fa484ef3c (diff) | |
download | pw-darwin-f5a04a9f49ff5a1dd493c135efbf0e9dde2c97d1.tar.gz pw-darwin-f5a04a9f49ff5a1dd493c135efbf0e9dde2c97d1.tar.zst pw-darwin-f5a04a9f49ff5a1dd493c135efbf0e9dde2c97d1.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]; |