[hurd, commited 1/3] hurd: Make adjtime reject out-of-range tv_usec values

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.cvs,gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
From: Michael Kelly <[email protected]>

---
 sysdeps/mach/hurd/adjtime.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sysdeps/mach/hurd/adjtime.c b/sysdeps/mach/hurd/adjtime.c
index c25b666a22..915b86da13 100644
--- a/sysdeps/mach/hurd/adjtime.c
+++ b/sysdeps/mach/hurd/adjtime.c
@@ -37,6 +37,13 @@ __adjtime (const struct timeval *delta, struct timeval *olddelta)
   if (olddelta == NULL)
     olddelta = &dummy;
 
+  if (delta != NULL)
+    {
+      if (delta->tv_usec >=  TIME_MICROS_MAX ||
+          delta->tv_usec <= -TIME_MICROS_MAX)
+       return EINVAL;
+    }
+
   err = __host_adjust_time (hostpriv,
 			    /* `time_value_t' and `struct timeval' are in
                                fact identical with the names changed.  */
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.