aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil/gr_util.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2012-12-28 20:19:54 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2012-12-28 20:19:54 +0000
commit167145a17d2c39be959742a0e44ce26c1e5fc61d (patch)
treee73ee2d83d44779fb3d06fae8f3af21673bfdd3e /lib/libutil/gr_util.c
parentb76bfc09c3061d1ba7a28a9b88a5023b39446b14 (diff)
downloadsrc-167145a17d2c39be959742a0e44ce26c1e5fc61d.tar.gz
src-167145a17d2c39be959742a0e44ce26c1e5fc61d.zip
Do not leave parts of the new group uninitialized in gr_dup().
Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Reported by: pjd
Notes
Notes: svn path=/head/; revision=244777
Diffstat (limited to 'lib/libutil/gr_util.c')
-rw-r--r--lib/libutil/gr_util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libutil/gr_util.c b/lib/libutil/gr_util.c
index 437fd780b75d..759e6e892512 100644
--- a/lib/libutil/gr_util.c
+++ b/lib/libutil/gr_util.c
@@ -461,10 +461,14 @@ gr_dup(const struct group *gr)
if (gr->gr_name != NULL) {
newgr->gr_name = dst;
dst = stpcpy(dst, gr->gr_name) + 1;
+ } else {
+ newgr->gr_name = NULL;
}
if (gr->gr_passwd != NULL) {
newgr->gr_passwd = dst;
dst = stpcpy(dst, gr->gr_passwd) + 1;
+ } else {
+ newgr->gr_passwd = NULL;
}
newgr->gr_gid = gr->gr_gid;
if (gr->gr_mem != NULL) {