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

Samuel Thibault samuel.thibault@ens-lyon.org
Wed Apr 15 20:59:03 GMT 2026


From: Michael Kelly <mike@weatherwax.co.uk>

---
 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



More information about the Libc-alpha mailing list