This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/16141] strptime %z offset restriction
- From: "f22raptorf22 at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 08 Nov 2013 15:50:23 +0000
- Subject: [Bug libc/16141] strptime %z offset restriction
- Auto-submitted: auto-generated
- References: <bug-16141-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=16141
--- Comment #1 from f22raptorf22 at gmail dot com ---
Created attachment 7271
--> https://sourceware.org/bugzilla/attachment.cgi?id=7271&action=edit
tst-strptime2 -- modified
Not that there are to-the-minute timezones, but it can also be observed that
the conversion to decimal does not properly parse the minutes. This test
program also illustrates the 1200 cap for the offset.
This: { "1113472456 +1159", 43140 }
Yields: round 3: tm_gmtoff is 43128
This: { "1113472456 +1201", 43260 }
Yields: round 4: strptime unexpectedly failed
Making a change to reflect something similar to the below, should display
proper behavior (and most likely less computational work):
while (n < 4 && *rp >= '0' && *rp <= '9')
{
if(n < 2)
hrs = hrs * 10 + *rp++ - '0';
else
min = min * 10 + *rp++ - '0';
++n;
}
if (n != 2 && n != 4)
/* Only two or four digits recognized. */
return NULL;
else if (hrs*100 + min > 2400)
return NULL;
tm->tm_gmtoff = hrs*3600 + min*60;
if (neg)
tm->tm_gmtoff = -tm->tm_gmtoff;
}
--
You are receiving this mail because:
You are on the CC list for the bug.