summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread
diff options
context:
space:
mode:
authorkurt <kurt@openbsd.org>2006-02-16 21:53:24 +0000
committerkurt <kurt@openbsd.org>2006-02-16 21:53:24 +0000
commit0059bec28a59ea3009809fedcc80dddf53122532 (patch)
tree610c9647b4e2954a084a24220dc274e7ce0f5935 /lib/libpthread/uthread
parentsqphy(4) here on the mii side, found in dmesg from Stefek Zaba (diff)
downloadwireguard-openbsd-0059bec28a59ea3009809fedcc80dddf53122532.tar.xz
wireguard-openbsd-0059bec28a59ea3009809fedcc80dddf53122532.zip
cap seconds to 100 million per man page and kernel nanosleep impl.
prevents userland from causing an overflow of tv_sec. okay marc@
Diffstat (limited to 'lib/libpthread/uthread')
-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;