summaryrefslogtreecommitdiffstats
path: root/libutil
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
commit3a3bcd13e99f20e0db107edca2d675ffb65cadc4 (patch)
treec6502fb6b92b68cca92ddfee76016f5be9cdcdd2 /libutil
parentaa220b5f62d62ea62dc8ac4e3a26696ee05faba7 (diff)
downloadpw-darwin-3a3bcd13e99f20e0db107edca2d675ffb65cadc4.tar.gz
pw-darwin-3a3bcd13e99f20e0db107edca2d675ffb65cadc4.tar.zst
pw-darwin-3a3bcd13e99f20e0db107edca2d675ffb65cadc4.zip
Do not leave parts of the new group uninitialized in gr_dup().
Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Reported by: pjd
Diffstat (limited to 'libutil')
-rw-r--r--libutil/gr_util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libutil/gr_util.c b/libutil/gr_util.c
index 437fd78..759e6e8 100644
--- a/libutil/gr_util.c
+++ b/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) {