core dump from within asctime_r()

Edwin Groothuis edwin at
Sat Jan 30 21:22:41 UTC 2010

Robert Elz <kre <at> munnari.OZ.AU> writes:

> 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.

Ouch, that is a good one.

I don't know if these are FreeBSD specific, but the following ones take the
"struct tm *" without checking the values neither:

* time1() via mktime(), gmtime().
* asctime_r().


More information about the tz mailing list