Changeset 7104:cdbcb73239ee in nginx


Ignore:
Timestamp:
09/13/17 12:53:19 (2 months ago)
Author:
Maxim Dounin <mdounin@…>
Branch:
default
Message:

Introduced time truncation to December 31, 9999 (ticket #1368).

Various buffers are allocated in an assumption that there would be
no more than 4 year digits. This might not be true on platforms
with 64-bit time_t, as 64-bit time_t is able to represent more than that.
Such dates with more than 4 year digits hardly make sense though, as
various date formats in use do not allow them anyway.

As such, all dates are now truncated by ngx_gmtime() to December 31, 9999.
This should have no effect on valid dates, though will prevent potential
buffer overflows on invalid ones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/core/ngx_times.c

    r7103 r7104  
    312312    sec = t % 86400;
    313313
     314    /*
     315     * no more than 4 year digits supported,
     316     * truncate to December 31, 9999, 23:59:59
     317     */
     318
     319    if (days > 2932896) {
     320        days = 2932896;
     321        sec = 86399;
     322    }
     323
    314324    /* January 1, 1970 was Thursday */
    315325
Note: See TracChangeset for help on using the changeset viewer.