Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen _gr_copy() can get called with fromgrp->gr_mem ...



details:   https://anonhg.NetBSD.org/src/rev/2adf0a6689e4
branches:  trunk
changeset: 765887:2adf0a6689e4
user:      sjg <sjg%NetBSD.org@localhost>
date:      Thu Jun 09 05:11:17 2011 +0000

description:
_gr_copy() can get called with fromgrp->gr_mem == NULL.

diffstat:

 lib/libc/gen/getgrent.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 135d650f2cdd -r 2adf0a6689e4 lib/libc/gen/getgrent.c
--- a/lib/libc/gen/getgrent.c   Thu Jun 09 02:59:22 2011 +0000
+++ b/lib/libc/gen/getgrent.c   Thu Jun 09 05:11:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getgrent.c,v 1.62 2008/04/28 20:22:59 martin Exp $     */
+/*     $NetBSD: getgrent.c,v 1.63 2011/06/09 05:11:17 sjg Exp $        */
 
 /*-
  * Copyright (c) 1999-2000, 2004-2005 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
 #if 0
 static char sccsid[] = "@(#)getgrent.c 8.2 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: getgrent.c,v 1.62 2008/04/28 20:22:59 martin Exp $");
+__RCSID("$NetBSD: getgrent.c,v 1.63 2011/06/09 05:11:17 sjg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -270,6 +270,9 @@
        COPYSTR(grp->gr_passwd, fromgrp->gr_passwd);
        grp->gr_gid = fromgrp->gr_gid;
 
+       if (fromgrp->gr_mem == NULL)
+               return 0;
+
        for (memc = 0; fromgrp->gr_mem[memc]; memc++)
                continue;
        memc++;                                 /* for final NULL */



Home | Main Index | Thread Index | Old Index