#3880: integer overflow in date.c (mutt_mktime)
-----------------------+----------------------
  Reporter:  vinc17    |      Owner:  mutt-dev
      Type:  defect    |     Status:  new
  Priority:  critical  |  Milestone:
 Component:  mutt      |    Version:  1.7.0
Resolution:            |   Keywords:
-----------------------+----------------------

Comment (by code@…):

 {{{
 After taking another look at this, you're right, it's not that simple.
 Even the simple case I thought I covered is broken: the subtraction
 (in my patch) will always do nothing, because the two values that
 produce the subtrahend are both already representations of GMT.

 Calculating the local timezone offset is simple enough; it's just
 gmtime(&now) - localtime(&now).  Times requiring that adjustment are
 trivial to fix.  The trickier part is when converting (for example)
 the sender's local time, such as what's done in mbox.c.

 This really ought to be trivial... but switching to the system mktime
 would require more comprehensive changes.  I have to say, over the
 years I've been pretty annoyed with the time manipulation functions
 available in C/POSIX.  There are a couple dozen of them, they all use
 different data structures, and none of them do exactly what you need
 them to.  :-(
 }}}

--
Ticket URL: <https://dev.mutt.org/trac/ticket/3880#comment:20>
Mutt <http://www.mutt.org/>
The Mutt mail user agent

Reply via email to