]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
Do not leave parts of the new group uninitialized in gr_dup().
authorBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 28 Dec 2012 20:19:54 +0000 (20:19 +0000)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 28 Dec 2012 20:19:54 +0000 (20:19 +0000)
Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
Reported by: pjd

libutil/gr_util.c

index 437fd780b75dc52b965a9432b344f11fb60e7313..759e6e8925121bfc9bd86028c485f015b097d192 100644 (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;
        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;
        }
        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) {
        }
        newgr->gr_gid = gr->gr_gid;
        if (gr->gr_mem != NULL) {