core dump from within asctime_r()

Tony Finch dot at dotat.at
Sat Jan 30 23:37:52 UTC 2010


On Sat, 30 Jan 2010, Robert Elz wrote:
>
> ctime() is (of course) just asctime(locatime(t))
>
> locatime() can return NULL these days, and given a nonsense time
> value (which is quite likely under these circumstances), probably did,
> but asctime() doesn't expect anything but a valus "struct tm *" and will
> simply dereference NULL is NULL is returned from localtime() - instant core.

This code follows the C standard, so this bug is a defect in the standard.
It has not been corrected in the latest committee draft.
http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1425.pdf

Tony.
-- 
f.anthony.n.finch  <dot at dotat.at>  http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.



More information about the tz mailing list