Source-Changes-HG archive

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

[src/trunk]: src/lib/libpuffs In getgroups(), copy only up to the number of s...



details:   https://anonhg.NetBSD.org/src/rev/1480ffb42f90
branches:  trunk
changeset: 749174:1480ffb42f90
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Nov 20 14:23:54 2009 +0000

description:
In getgroups(), copy only up to the number of supplementary groups
that actually exist.

diffstat:

 lib/libpuffs/creds.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 963cf15d9580 -r 1480ffb42f90 lib/libpuffs/creds.c
--- a/lib/libpuffs/creds.c      Fri Nov 20 14:11:38 2009 +0000
+++ b/lib/libpuffs/creds.c      Fri Nov 20 14:23:54 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: creds.c,v 1.14 2007/12/08 19:57:02 pooka Exp $ */
+/*     $NetBSD: creds.c,v 1.15 2009/11/20 14:23:54 pooka Exp $ */
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: creds.c,v 1.14 2007/12/08 19:57:02 pooka Exp $");
+__RCSID("$NetBSD: creds.c,v 1.15 2009/11/20 14:23:54 pooka Exp $");
 #endif /* !lint */
 
 /*
@@ -85,10 +85,11 @@
 
        if (!UUCCRED(pkcr)) {
                errno = EOPNOTSUPP;
+               *ngids = 0;
                return -1;
        }
 
-       ncopy = MIN(*ngids, NGROUPS);
+       ncopy = MIN(*ngids, pkcr->pkcr_uuc.cr_ngroups);
        (void)memcpy(rgids, pkcr->pkcr_uuc.cr_groups, sizeof(gid_t) * ncopy);
        *ngids = (short)ncopy;
 



Home | Main Index | Thread Index | Old Index