ctime passes the result from localtime directly to asctime. But in case of error, localtime returns 0. This causes an error (NULL pointer dereference) in asctime. based on patch by Omer Anson.
9 lines
124 B
C
9 lines
124 B
C
#include <time.h>
|
|
|
|
char *ctime(const time_t *t)
|
|
{
|
|
struct tm *tm = localtime(t);
|
|
if (!tm) return 0;
|
|
return asctime(tm);
|
|
}
|