diff options
| author | Peter Wemm <peter@FreeBSD.org> | 2002-12-05 19:54:47 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 2002-12-05 19:54:47 +0000 |
| commit | 878c9687ec745264a362ad203995d9e4238385bd (patch) | |
| tree | faf1e7a8f537ed85a183276b105b4a3c206fa547 /lib/libc/stdtime/localtime.c | |
| parent | ca894c66e0135e2387c24389027c99be616f5ad0 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdtime/localtime.c')
| -rw-r--r-- | lib/libc/stdtime/localtime.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index c0442746de7d..a82256e3b15a 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -1476,6 +1476,12 @@ int * const okayp; */ bits = TYPE_BIT(time_t) - 1; /* + ** If we have more than this, we will overflow tm_year for tmcomp(). + ** We should really return an error if we cannot represent it. + */ + if (bits > 56) + bits = 56; + /* ** If time_t is signed, then 0 is just above the median, ** assuming two's complement arithmetic. ** If time_t is unsigned, then (1 << bits) is just above the median. |
