summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Miller <kurt@cvs.openbsd.org>2006-02-16 21:53:25 +0000
committerKurt Miller <kurt@cvs.openbsd.org>2006-02-16 21:53:25 +0000
commit5413bf7b9ab3c7d1578742801c146a6938972768 (patch)
treed7d3bc1ac7d03b18f1ed4dfba70fcc6f0802302b
parent3ab7a13d36424647005618db547f79c2cca25953 (diff)
cap seconds to 100 million per man page and kernel nanosleep impl.
prevents userland from causing an overflow of tv_sec. okay marc@
-rw-r--r--lib/libpthread/uthread/uthread_nanosleep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_nanosleep.c b/lib/libpthread/uthread/uthread_nanosleep.c
index 26a26c1c678..05ace81b915 100644
--- a/lib/libpthread/uthread/uthread_nanosleep.c
+++ b/lib/libpthread/uthread/uthread_nanosleep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_nanosleep.c,v 1.7 2001/12/31 18:23:15 fgsch Exp $ */
+/* $OpenBSD: uthread_nanosleep.c,v 1.8 2006/02/16 21:53:24 kurt Exp $ */
/*
* Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -53,7 +53,8 @@ nanosleep(const struct timespec * time_to_sleep,
_thread_enter_cancellation_point();
/* Check if the time to sleep is legal: */
- if (time_to_sleep == NULL || time_to_sleep->tv_sec < 0 ||
+ if (time_to_sleep == NULL ||
+ time_to_sleep->tv_sec < 0 || time_to_sleep->tv_sec > 100000000 ||
time_to_sleep->tv_nsec < 0 || time_to_sleep->tv_nsec >= 1000000000) {
/* Return an EINVAL error : */
errno = EINVAL;