Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jun 2019 18:30:49 +0000
From:      bugzilla-noreply@freebsd.org
To:        standards@FreeBSD.org
Subject:   [Bug 238547] gmtime does not return NULL if the input cannot be represented as struct tm
Message-ID:  <bug-238547-99@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238547

            Bug ID: 238547
           Summary: gmtime does not return NULL if the input cannot be
                    represented as struct tm
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: standards@FreeBSD.org
          Reporter: urisimchoni@gmail.com

When the input to gmtime() represents a time that's too far in the future, =
and
whose year does not fit in the tm_year field, gmtime() returns a struct tm =
with
all-zeros.

Contrast this with POSIX
(https://pubs.opengroup.org/onlinepubs/009695399/functions/gmtime.html) whi=
ch
states that in this case the return should be NULL with errno set to reflect
the error. Other libc's (glibc, MacOS, MSVC) also return NULL in this case.

For example,

time_t val =3D 0x7fffffffffffffffll;
gmtime(&val)

does not return NULL.

This affects my ability to correctly calculate the maximum allowed value of
time_t in Samba's configure phase.

Thanks,
Uri.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238547-99>