From 3a3bcd13e99f20e0db107edca2d675ffb65cadc4 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Fri, 28 Dec 2012 20:19:54 +0000 Subject: Do not leave parts of the new group uninitialized in gr_dup(). Submitted by: Christoph Mallon Reported by: pjd --- libutil/gr_util.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libutil') 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) { -- cgit v1.2.3-56-ge451