From e79af11c364447c85d4824fc604a011ffefcb7e6 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 10 Apr 2000 15:30:06 +0000 Subject: [PATCH] Update. 2000-04-10 Ulrich Drepper * sysdeps/unix/clock_settime.c (clock_settime): Test tv_nsec value for correct range. From code by Kaz Kylheku . --- ChangeLog | 5 +++++ sysdeps/unix/clock_settime.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index f388f79..004dfe0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-04-10 Ulrich Drepper + + * sysdeps/unix/clock_settime.c (clock_settime): Test tv_nsec value + for correct range. From code by Kaz Kylheku . + 2000-04-09 Ulrich Drepper * sysdeps/unix/clock_gettime.c: New file. diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c index daee2e2..36bd98f 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: -- 2.7.4