Module Name: src
Committed By: pooka
Date: Fri Nov 20 14:23:54 UTC 2009
Modified Files:
src/lib/libpuffs: creds.c
Log Message:
In getgroups(), copy only up to the number of supplementary groups
that actually exist.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libpuffs/creds.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libpuffs/creds.c
diff -u src/lib/libpuffs/creds.c:1.14 src/lib/libpuffs/creds.c:1.15
--- src/lib/libpuffs/creds.c:1.14 Sat Dec 8 19:57:02 2007
+++ src/lib/libpuffs/creds.c Fri Nov 20 14:23:54 2009
@@ -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;