[glibc] hurd: Make adjtime reject out-of-range tv_usec values

Samuel Thibault via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4821a3e0bc867bb8a75a9621f6ec3ca4c5e01b43

commit 4821a3e0bc867bb8a75a9621f6ec3ca4c5e01b43
Author: Michael Kelly <[email protected]>
Date:   Wed Apr 15 22:15:39 2026 +0200

    hurd: Make adjtime reject out-of-range tv_usec values

Diff:
---
 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.  */
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.