Date: Fri, 31 Oct 2025 17:08:50 GMT From: Ed Maste <emaste@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: ce03706ab26c - main - openssh: Handle localtime_r() failure by return "UNKNOWN-TIME" Message-ID: <202510311708.59VH8og4035496@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ce03706ab26c5770150f1ef96aca36b69baa535f commit ce03706ab26c5770150f1ef96aca36b69baa535f Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2025-10-31 17:04:51 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-10-31 17:08:45 +0000 openssh: Handle localtime_r() failure by return "UNKNOWN-TIME" Apply openssh-portable commit 8b6c1f402feb by deraadt@openbsd.org Obtained from: openssh-portable PR: 288773 Reported by: wosch Sponsored by: The FreeBSD Foundation --- crypto/openssh/misc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crypto/openssh/misc.c b/crypto/openssh/misc.c index dd0bd032ae3c..1ed71646ebe4 100644 --- a/crypto/openssh/misc.c +++ b/crypto/openssh/misc.c @@ -2535,8 +2535,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); } /*home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510311708.59VH8og4035496>
