Do not leave parts of the new group uninitialized in gr_dup().

Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Reported by:	pjd
This commit is contained in:
Baptiste Daroussin 2012-12-28 20:19:54 +00:00
parent b76bfc09c3
commit 167145a17d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244777

View File

@ -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) {