FreeBSD Bugzilla – Attachment 150452 Details for
Bug 195868
Integer overflow in kern/subr_clock.c : clock_ct_to_ts() [patch]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for integer overflow
subr_clock-141211.patch (text/plain), 1.24 KB, created by
leo
on 2014-12-11 02:14:51 UTC
(
hide
)
Description:
Patch for integer overflow
Filename:
MIME Type:
Creator:
leo
Created:
2014-12-11 02:14:51 UTC
Size:
1.24 KB
patch
obsolete
>--- /usr/src/sys/kern/subr_clock.c.orig 2014-12-11 04:09:18.000000000 +0300 >+++ /usr/src/sys/kern/subr_clock.c 2099-12-11 04:48:44.000000000 +0300 >@@ -87,13 +87,13 @@ > > > #define FEBRUARY 2 >-#define days_in_year(y) (leapyear(y) ? 366 : 365) >+#define days_in_year(y) (leapyear(y) ? (time_t)366 : (time_t)365) > #define days_in_month(y, m) \ > (month_days[(m) - 1] + (m == FEBRUARY ? leapyear(y) : 0)) > /* Day of week. Days are counted from 1/1/1970, which was a Thursday */ >-#define day_of_week(days) (((days) + 4) % 7) >+#define day_of_week(days) (((time_t)(days) + 4) % 7) > >-static const int month_days[12] = { >+static const time_t month_days[12] = { > 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 > }; > >@@ -107,7 +107,7 @@ > * It is otherwise equivalent. > */ > static int >-leapyear(int year) >+leapyear(time_t year) > { > int rv = 0; > >@@ -133,8 +133,8 @@ > int > clock_ct_to_ts(struct clocktime *ct, struct timespec *ts) > { >- time_t secs; >- int i, year, days; >+ time_t year, days, secs; >+ int i; > > year = ct->year; > >@@ -180,9 +180,9 @@ > void > clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) > { >- int i, year, days; >+ int i; > time_t rsec; /* remainder seconds */ >- time_t secs; >+ time_t year, days, secs; > > secs = ts->tv_sec; > days = secs / SECDAY;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 195868
: 150452