diff options
author | sef <sef@FreeBSD.org> | 1997-06-25 01:01:21 +0000 |
---|---|---|
committer | sef <sef@FreeBSD.org> | 1997-06-25 01:01:21 +0000 |
commit | c756cf9cdf6dd4520edd6ba6b5770071a768e17f (patch) | |
tree | f72ddf6c7ac94e569403db25a8de2d1a0153e758 /sys/i386/ibcs2 | |
parent | 7559f25babddfd7f47352d78f3b4e5b31fd6dd82 (diff) | |
download | FreeBSD-src-c756cf9cdf6dd4520edd6ba6b5770071a768e17f.zip FreeBSD-src-c756cf9cdf6dd4520edd6ba6b5770071a768e17f.tar.gz |
Do The Right Thing when an iBCS2 program does getgroups(0, whatever) -- we
were returning EFAULT, when it is a completely acceptable thing to do.
Also, at the same time, be a *bit* optimizing and don't allocate any
"stackgrap" memory if we're not going to use it.
This is another Oracle-discovered problem.
Submitted by: Steven Wallace
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r-- | sys/i386/ibcs2/ibcs2_misc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/i386/ibcs2/ibcs2_misc.c b/sys/i386/ibcs2/ibcs2_misc.c index dfc4bad..a876675 100644 --- a/sys/i386/ibcs2/ibcs2_misc.c +++ b/sys/i386/ibcs2/ibcs2_misc.c @@ -45,7 +45,7 @@ * * @(#)sun_misc.c 8.1 (Berkeley) 6/18/93 * - * $Id: ibcs2_misc.c,v 1.19 1997/04/06 14:10:50 dfr Exp $ + * $Id: ibcs2_misc.c,v 1.20 1997/05/07 20:05:44 peter Exp $ */ /* @@ -653,10 +653,14 @@ ibcs2_getgroups(p, uap, retval) if (SCARG(uap, gidsetsize)) { SCARG(&sa, gidset) = stackgap_alloc(&sg, NGROUPS_MAX * sizeof(gid_t *)); + iset = stackgap_alloc(&sg, SCARG(uap, gidsetsize) * + sizeof(ibcs2_gid_t)); } - iset = stackgap_alloc(&sg, SCARG(uap, gidsetsize)*sizeof(ibcs2_gid_t)); if (error = getgroups(p, &sa, retval)) return error; + if (SCARG(uap, gidsetsize) == 0) + return 0; + for (i = 0, gp = SCARG(&sa, gidset); i < retval[0]; i++) iset[i] = (ibcs2_gid_t)*gp++; if (retval[0] && (error = copyout((caddr_t)iset, |