diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2025-10-31 17:04:51 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2025-11-05 16:34:06 +0000 |
| commit | 4fbf901a2925ec2598167c1c4f04e78c06960869 (patch) | |
| tree | 3d67961d85a34476b1ccb02fdf18bf71937364bc | |
| parent | b775b191b6bf02bab3322ffe7a2c2396a54e9f7b (diff) | |
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
(cherry picked from commit ce03706ab26c5770150f1ef96aca36b69baa535f)
(cherry picked from commit 0a45aa9e954acc75484d59ad42ee440aa7f034c7)
| -rw-r--r-- | crypto/openssh/misc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/openssh/misc.c b/crypto/openssh/misc.c index 1b4b55c5034d..e129218cdd5c 100644 --- a/crypto/openssh/misc.c +++ b/crypto/openssh/misc.c @@ -2534,8 +2534,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); } /* |
