Summary: | Integer overflow in kern/subr_clock.c : clock_ct_to_ts() [patch] | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | leo | ||||
Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Some People | CC: | leo, vas | ||||
Priority: | --- | ||||||
Version: | 10.1-RELEASE | ||||||
Hardware: | amd64 | ||||||
OS: | Any | ||||||
Attachments: |
|
A commit references this bug: Author: kib Date: Fri Dec 12 09:37:19 UTC 2014 New revision: 275727 URL: https://svnweb.freebsd.org/changeset/base/275727 Log: For architectures where time_t is wide enough, in particular, 64bit platforms, avoid overflow after year 2038 in clock_ct_to_ts(). PR: 195868 Reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Changes: head/sys/kern/subr_clock.c A commit references this bug: Author: kib Date: Fri Dec 19 09:34:15 UTC 2014 New revision: 275932 URL: https://svnweb.freebsd.org/changeset/base/275932 Log: MFC r275727: For architectures where time_t is wide enough, in particular, 64bit platforms, avoid overflow after year 2038 in clock_ct_to_ts(). PR: 195868 Changes: _U stable/10/ stable/10/sys/kern/subr_clock.c Committed as r275727. |
Created attachment 150452 [details] Patch for integer overflow How to repeat: set RTC 99 year by BIOS Result: Error message "Invalid time in real time clock" in system log Expected: system time must be set to 2099 Integer overflow for case sizeof(time_t) > 4 at operator: kern/subr_clock.c: clock_ct_to_ts(struct clocktime *ct, struct timespec *ts) { time_t secs; int i, year, days; .... secs = ((days * 24 + ct->hour) * 60 + ct->min) * 60 + ct->sec;