| Summary: | Certificate validity dates greater than 32bit are truncated to 2038-01-19T03:14:07 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Anthony J. Martinez <anthony> | ||||||
| Component: | ssh-keygen | Assignee: | Assigned to nobody <unassigned-bugs> | ||||||
| Status: | CLOSED FIXED | ||||||||
| Severity: | normal | CC: | dtucker | ||||||
| Priority: | P5 | ||||||||
| Version: | 8.4p1 | ||||||||
| Hardware: | All | ||||||||
| OS: | Linux | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 3302 | ||||||||
| Attachments: |
|
||||||||
|
Description
Anthony J. Martinez
2021-07-01 22:20:08 AEST
It looks like the cert validity is fine, it's the formatting function that has the limit:
if (cert->valid_after != 0) {
/* XXX revisit INT_MAX in 2038 :) */
tt = cert->valid_after > INT_MAX ?
INT_MAX : cert->valid_after;
tm = localtime(&tt);
strftime(from, sizeof(from), "%Y-%m-%dT%H:%M:%S", tm);
}
Unfortunately there's no TIME_T_MAX, and while we can figure out how big time_t is but there's nothing specifying whether it's signed or unsigned.
Anyway there's a format_absolute_time in misc.c, we should factor these out of sshkey.c and fix it in format_absolute_time.
Created attachment 3531 [details]
allow formatting dates >INT_MAX
This patch ought to fix it on platforms with 64bit time_t, although it'll also require some work in configure to be correct on other systems.
Created attachment 3532 [details]
allow formatting dates >INT_MAX
That makes a lot more sense. I'm not a C programmer by any means, but I saw uint64 in the cert creation code and the protocol spec and was baffled by this output from ssh-keygen. Thanks for finding the root cause! The fixes have gone in and will be in the next major release. Thanks for the report. https://github.com/openssh/openssh-portable/commit/6c29b387cd64a57b0ec8ae7d2c8d02789d88fcc3 and https://github.com/openssh/openssh-portable/commit/f5fc6a4c3404bbf65c21ca6361853b33d78aa87e closing bugs resolved before openssh-8.9 |