diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-03-05 20:32:14 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-03-05 20:32:14 +0000 |
commit | 2db6b5f9000f8d4a1fda3d92872ba504d423a774 (patch) | |
tree | 0bfefb5302ec9287e3bcc598d43fd817578847c3 /sys/compat/ibcs2 | |
parent | 9e8a79a11a25843a5b1f887e9dea08593a7f1886 (diff) |
fix size check case for getgroups; pbucich@sion.com
Diffstat (limited to 'sys/compat/ibcs2')
-rw-r--r-- | sys/compat/ibcs2/ibcs2_misc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/compat/ibcs2/ibcs2_misc.c b/sys/compat/ibcs2/ibcs2_misc.c index 793eaba953a..b817aac8f6c 100644 --- a/sys/compat/ibcs2/ibcs2_misc.c +++ b/sys/compat/ibcs2/ibcs2_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ibcs2_misc.c,v 1.14 1999/02/10 00:16:11 niklas Exp $ */ +/* $OpenBSD: ibcs2_misc.c,v 1.15 2000/03/05 20:32:13 deraadt Exp $ */ /* $NetBSD: ibcs2_misc.c,v 1.23 1997/01/15 01:37:49 perry Exp $ */ /* @@ -638,13 +638,15 @@ ibcs2_sys_getgroups(p, v, retval) } if ((error = sys_getgroups(p, &sa, retval)) != 0) return error; - 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, - (caddr_t)SCARG(uap, gidset), - sizeof(ibcs2_gid_t) * retval[0]))) - return error; - return 0; + if (iset) { + 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, + (caddr_t)SCARG(uap, gidset), + sizeof(ibcs2_gid_t) * retval[0]))) + return error; + } + return 0; } int |