[openssh-commits] [openssh] 01/02: upstream: Handle localtime_r() failure by return "UNKNOWN-TIME"
git+noreply at mindrot.org
git+noreply at mindrot.org
Wed Aug 13 09:21:00 AEST 2025
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 8b6c1f402feb9eb6438003a312d7ffe8d5669896
Author: deraadt at openbsd.org <deraadt at openbsd.org>
AuthorDate: Mon Aug 11 14:37:43 2025 +0000
upstream: Handle localtime_r() failure by return "UNKNOWN-TIME"
which is only used in user-visible contexts. freebsd 288773 shows their
localtime_r() has failed at least once for unknown reason. discussed with djm
OpenBSD-Commit-ID: 68f4c92d46b2578d4594b0ed940958d597fd61ac
---
misc.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/misc.c b/misc.c
index 838a7f788..2e77eeb88 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.201 2025/07/31 11:23:39 job Exp $ */
+/* $OpenBSD: misc.c,v 1.202 2025/08/11 14:37:43 deraadt Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@@ -2540,8 +2540,10 @@ format_absolute_time(uint64_t t, char *buf, size_t len)
time_t tt = t > SSH_TIME_T_MAX ? SSH_TIME_T_MAX : t;
struct tm tm;
- localtime_r(&tt, &tm);
- strftime(buf, len, "%Y-%m-%dT%H:%M:%S", &tm);
+ if (localtime_r(&tt, &tm) == NULL)
+ strlcpy(buf, "UNKNOWN-TIME", len);
+ else
+ strftime(buf, len, "%Y-%m-%dT%H:%M:%S", &tm);
}
/*
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list