diff options
author | alfred <alfred@FreeBSD.org> | 1999-08-19 23:06:11 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 1999-08-19 23:06:11 +0000 |
commit | 557b906ef8a8572a4a3828011b21ce414ce2e283 (patch) | |
tree | 0ec3230edcd09a8395fca2f7d9285598e2025c07 /lib/libpthread/thread/thr_select.c | |
parent | 0b6fbc2a5b83ef6eb4b1a5f56ab141146e1d09cc (diff) | |
download | FreeBSD-src-557b906ef8a8572a4a3828011b21ce414ce2e283.zip FreeBSD-src-557b906ef8a8572a4a3828011b21ce414ce2e283.tar.gz |
Sanity check time structures passed in, return EINVAL like the system
calls do to avoid corrupting the thread library's concept of wakeup
time.
PR: kern/12141
Reviewed by: deischen, eivind
Diffstat (limited to 'lib/libpthread/thread/thr_select.c')
-rw-r--r-- | lib/libpthread/thread/thr_select.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_select.c b/lib/libpthread/thread/thr_select.c index 67de75d..2042fde 100644 --- a/lib/libpthread/thread/thr_select.c +++ b/lib/libpthread/thread/thr_select.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_select.c,v 1.8 1999/06/23 15:01:22 dt Exp $ + * $Id: uthread_select.c,v 1.9 1999/08/05 12:15:21 deischen Exp $ */ #include <unistd.h> #include <errno.h> @@ -53,6 +53,10 @@ select(int numfds, fd_set * readfds, fd_set * writefds, int pfd_index, got_one = 0, fd_count = 0; struct pthread_poll_data data; + if (timeout->tv_sec < 0 || + timeout->tv_usec < 0 || timeout->tv_usec >= 1000000) + return (EINVAL); + if (numfds > _thread_dtablesize) { numfds = _thread_dtablesize; } |