Message ID | 1417646760-19563-2-git-send-email-james@loowit.net |
---|---|
State | New |
Headers | show |
On 03 Dec 2014 14:45, James Perkins wrote: > --- a/time/strptime_l.c > +++ b/time/strptime_l.c > > else if (n != 4) > /* Only two or four digits recognized. */ > return NULL; > - else > - { > - /* We have to convert the minutes into decimal. */ > - if (val % 100 >= 60) > - return NULL; > - val = (val / 100) * 100 + ((val % 100) * 50) / 30; > - } > + else if (val % 100 >= 60) > + /* Minutes valid range is 0 through 59. */ > + return NULL; > if (val > 1200) > return NULL; > - tm->tm_gmtoff = (val * 3600) / 100; > + tm->tm_gmtoff = (val / 100) * 3600 + (val % 100) * 60; looks like you're adding a bug here with the 1200 check. you fix it later in the patch series, but this follows the general policy of "don't add bugs in the middle of a series". all in all, i think you should squash these 4 patches into one. -mike
diff --git a/time/strptime_l.c b/time/strptime_l.c index b3a612e..be35f3b 100644 --- a/time/strptime_l.c +++ b/time/strptime_l.c @@ -770,16 +770,12 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM) else if (n != 4) /* Only two or four digits recognized. */ return NULL; - else - { - /* We have to convert the minutes into decimal. */ - if (val % 100 >= 60) - return NULL; - val = (val / 100) * 100 + ((val % 100) * 50) / 30; - } + else if (val % 100 >= 60) + /* Minutes valid range is 0 through 59. */ + return NULL; if (val > 1200) return NULL; - tm->tm_gmtoff = (val * 3600) / 100; + tm->tm_gmtoff = (val / 100) * 3600 + (val % 100) * 60; if (neg) tm->tm_gmtoff = -tm->tm_gmtoff; }