diff options
author | 2019-03-26 16:02:54 +0000 | |
---|---|---|
committer | 2019-03-26 16:02:54 +0000 | |
commit | 0493378205896afd86ef4c8d768f9b6bf58410cc (patch) | |
tree | 5023ffa8a58f32504255429ba21a134827695a7f /lib/libc | |
parent | Remove this assert, I can't do this here with UNVEIL_INSPECT (diff) | |
download | wireguard-openbsd-0493378205896afd86ef4c8d768f9b6bf58410cc.tar.xz wireguard-openbsd-0493378205896afd86ef4c8d768f9b6bf58410cc.zip |
adjtime(2): set EINVAL if delta overflows 64 bits of microseconds.
No other (known) BSD-derived adjtime(2) implementation checks for overflow
when converting delta into its final denomination of fractional seconds.
This is peculiar, as the call originates in 4.3BSD.
However, glibc, uclibc, and (to an extent) musl /do/ check the input and set
EINVAL if it exceeds a certain bound, so we'll just use the errno that they
use to be consistent with extant practice.
Prompted by the comment kettenis@ left when we switched to storing the
adjustment in an int64_t like ~5 years ago (kern_time.c,v 1.87).
Positive feedback from deraadt@, manpage bits ok jmc@,
no code complaints from otto@ or tedu@.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/sys/adjtime.2 | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libc/sys/adjtime.2 b/lib/libc/sys/adjtime.2 index 73090282201..b7d3aab8e74 100644 --- a/lib/libc/sys/adjtime.2 +++ b/lib/libc/sys/adjtime.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: adjtime.2,v 1.24 2019/01/18 05:51:58 schwarze Exp $ +.\" $OpenBSD: adjtime.2,v 1.25 2019/03/26 16:02:54 cheloha Exp $ .\" $NetBSD: adjtime.2,v 1.5 1995/10/12 15:40:44 jtc Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)adjtime.2 8.1 (Berkeley) 6/4/93 .\" -.Dd $Mdocdate: January 18 2019 $ +.Dd $Mdocdate: March 26 2019 $ .Dt ADJTIME 2 .Os .Sh NAME @@ -98,7 +98,17 @@ The argument is .Pf non- Dv NULL and specifies a microsecond value less than zero or -greater than or equal to 1 million. +greater than or equal to one million. +.It Bq Er EINVAL +The +.Fa delta +argument is +.Pf non- Dv NULL +and represents an adjustment greater than +.Dv INT64_MAX +microseconds or less than +.Dv INT64_MIN +microseconds. .It Bq Er EPERM The .Fa delta |