[patch] Fix BZ 18985 out of bounds access in strftime
Paul Pluzhnikov
ppluzhnikov@google.com
Sun Sep 20 18:45:00 GMT 2015
On Sun, Sep 20, 2015 at 11:39 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
>> tp->tm_hour = 1024;
>> strftime(..., "%H %I", tp); // produces "1024 04"
>>
>> that doesn't seem very desirable.
>
> That helps the programmer more than returning 0 would.
Yes, you convinced me that returning 0 is the wrong thing to do.
The remaining question was whether tm_hour==1024 should map to "1024"
or to "?". Your other example suggests that "1024" is more useful.
> Don't forget out-of-range tm_isdst: there's one place the code has undefined
> behavior if tm_isdst exceeds 1.
Thanks!
--
Paul Pluzhnikov
More information about the Libc-alpha
mailing list