about summary refs log tree commit diff
path: root/sysdeps/unix/clock_settime.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-04-10 15:30:06 +0000
committerUlrich Drepper <drepper@redhat.com>2000-04-10 15:30:06 +0000
commite79af11c364447c85d4824fc604a011ffefcb7e6 (patch)
treed2698cbcea24de565e0a33434e2a8962cf1dccf4 /sysdeps/unix/clock_settime.c
parent13fa3676961e9dd1a8a26eabec8aa9b2b4247899 (diff)
downloadglibc-e79af11c364447c85d4824fc604a011ffefcb7e6.tar.gz
glibc-e79af11c364447c85d4824fc604a011ffefcb7e6.tar.xz
glibc-e79af11c364447c85d4824fc604a011ffefcb7e6.zip
Update.
2000-04-10  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/clock_settime.c (clock_settime): Test tv_nsec value
	for correct range.  From code by Kaz Kylheku <kaz@ashi.footprints.net>.
Diffstat (limited to 'sysdeps/unix/clock_settime.c')
-rw-r--r--sysdeps/unix/clock_settime.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index daee2e2c93..36bd98fdf9 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -31,6 +31,13 @@ clock_settime (clockid_t clock_id, const struct timespec *tp)
   struct timeval tv;
   int retval;
 
+  /* Make sure the time cvalue is OK.  */
+  if (tp->tv_nsec < 0 || tp->tv_nsec >= 1000000000)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
   switch (clock_id)
     {
     case CLOCK_REALTIME: