Bug 1286694
| Summary: | X.509 certificate parsing handles leap years incorrectly in multiple ways. | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Rudolf Polzer <rpolzer> |
| Component: | kernel | Assignee: | Kernel Maintainer List <kernel-maint> |
| Status: | NEW --- | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | dhowells, gansalmon, itamar, jonathan, kernel-maint, madhu.chinakonda, mchehab |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | Bug | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Rudolf Polzer
2015-11-30 14:07:26 UTC
Sorry, the second error case would be Februrary xx, 2100. There also seems to be another related issue: Feb 29, 2017 is not rejected but handled as Mar 1, 2017. The reason is incorrect leap year logic: mon_len starts at 29: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/crypto/asymmetric_keys/x509_cert_parser.c?id=cc25b994acfbc901429da682d0f73c190e960206#n503 in 0 mod 4 years, it's set to 29: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/crypto/asymmetric_keys/x509_cert_parser.c?id=cc25b994acfbc901429da682d0f73c190e960206#n547 in 0 mod 100 but not 0 mod 400 years, it's set to 28: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/crypto/asymmetric_keys/x509_cert_parser.c?id=cc25b994acfbc901429da682d0f73c190e960206#n551 Probably the initialization should be changed to 28. Keeping the rest of the code as is, this will do: not 0 mod 4: 28 0 mod 100 but not 0 mod 400: 28 otherwise: 29 which is the correct rule. (In reply to Rudolf Polzer from comment #0) > if ((year / 100) % 4 != 0) This is the same as: year /= 100; if (year % 4 != 0) provided one doesn't use year again - which I am, which I think is the actual problem there. Exactly, the reuse of year in the mktime64() is what conflicts with this change of year. This report has not received an update in over 90 days. If this issue is still relevant to you, please do not hesitate to update this report with any relevant details on recent investigative steps or changes and we will absolutely work to understand how to best move forward. Otherwise, this bug report will need to be closed in 30 days. No worries, however; should you need still assistance after the report is closed, please do not hesitate to create a new bug report referencing this report and with any new details on the matter. NOTE: This is an automated mass update. |