This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix BZ 18985 out of bounds access in strftime


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]