2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 08:05:21 +00:00

4855. [bug] isc_time_formatshorttimestamp produced incorrect

output. [RT #46938]
This commit is contained in:
Mark Andrews
2018-01-04 09:57:40 +11:00
parent 7258b852cf
commit 1e10ef06ce
4 changed files with 41 additions and 2 deletions

View File

@@ -552,6 +552,9 @@ isc_time_formatshorttimestamp(const isc_time_t *t, char *buf, unsigned int len)
struct tm tm;
#endif
REQUIRE(t != NULL);
INSIST(t->nanoseconds < NS_PER_S);
REQUIRE(buf != NULL);
REQUIRE(len > 0);
now = (time_t)t->seconds;
@@ -562,7 +565,6 @@ isc_time_formatshorttimestamp(const isc_time_t *t, char *buf, unsigned int len)
#endif
INSIST(flen < len);
if (flen > 0U && len - flen >= 5) {
flen -= 1; /* rewind one character (Z) */
snprintf(buf + flen, len - flen, "%03u",
t->nanoseconds / NS_PER_MS);
}