summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2012-12-28 20:19:54 +0000
committerbapt <bapt@FreeBSD.org>2012-12-28 20:19:54 +0000
commitb69ff2af2f03611d0e09375381f91413c7d309a2 (patch)
treee73ee2d83d44779fb3d06fae8f3af21673bfdd3e /lib/libutil
parent618ba5b4be939ae336cc6a49e0535f46665346b7 (diff)
downloadFreeBSD-src-b69ff2af2f03611d0e09375381f91413c7d309a2.zip
FreeBSD-src-b69ff2af2f03611d0e09375381f91413c7d309a2.tar.gz
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 'lib/libutil')
-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 437fd78..759e6e8 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) {
OpenPOWER on IntegriCloud