summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/sys_generic.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 9e379a48fb6..b590c6ce82f 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.17 1999/02/14 21:11:01 millert Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.18 1999/03/22 02:22:15 deraadt Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -807,13 +807,18 @@ sys_poll(p, v, retval)
register_t *retval;
{
struct sys_poll_args *uap = v;
- size_t sz = sizeof(struct pollfd) * SCARG(uap, nfds);
+ size_t sz;
struct pollfd *pl;
int msec = SCARG(uap, timeout);
struct timeval atv;
int timo, ncoll, i, s, error, error2;
extern int nselcoll, selwait;
+ /* XXX constrain; This may not match standards */
+ if (SCARG(uap, nfds) > p->p_fd->fd_nfiles)
+ SCARG(uap, nfds) = p->p_fd->fd_nfiles;
+ sz = sizeof(struct pollfd) * SCARG(uap, nfds);
+
pl = (struct pollfd *) malloc(sz, M_TEMP, M_WAITOK);
if ((error = copyin(SCARG(uap, fds), pl, sz)) != 0)