[PATCH] Possible NULL deref in str_time

Started by Bill Moyersover 8 years ago1 messageshackers
Jump to latest
#1Bill Moyers
moyers@agora-net.com

I noticed that the output of pg_localtime() in str_time() is not checked
and can sometimes return NULL. It's pretty unlikely to occur, I guess if
the time() function was acting funny. For example if I define this:

time_t
fake_time(void *blah)
{
return 0x0110000000000000;
}

and then call fake_time() instead of time() everywhere, then str_time()
does the NULL dereference at startup.

* possible-null-deref-in-str_time.patch

Check the pg_localtime() output. This should not have a performance
impact because this function is not called often.

Attachments:

possible-null-deref-in-str_time.patchtext/x-patch; name=possible-null-deref-in-str_time.patchDownload+11-1