svn commit: r244777 - head/lib/libutil

Baptiste Daroussin bapt at FreeBSD.org
Fri Dec 28 20:19:55 UTC 2012


Author: bapt
Date: Fri Dec 28 20:19:54 2012
New Revision: 244777
URL: http://svnweb.freebsd.org/changeset/base/244777

Log:
  Do not leave parts of the new group uninitialized in gr_dup().
  
  Submitted by:	Christoph Mallon <christoph.mallon at gmx.de>
  Reported by:	pjd

Modified:
  head/lib/libutil/gr_util.c

Modified: head/lib/libutil/gr_util.c
==============================================================================
--- head/lib/libutil/gr_util.c	Fri Dec 28 19:02:28 2012	(r244776)
+++ head/lib/libutil/gr_util.c	Fri Dec 28 20:19:54 2012	(r244777)
@@ -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) {


More information about the svn-src-head mailing list