Fix portability and safety issues in pqTraceFormatTimestamp.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: f1be740a991406d7885047beb971e1ff5dbe8b71
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2021-03-31T21:00:30Z
Releases: 14.0
Fix portability and safety issues in pqTraceFormatTimestamp.

Remove confusion between time_t and pg_time_t; neither
gettimeofday() nor localtime() deal in the latter.
libpq indeed has no business using <pgtime.h> at all.

Use snprintf not sprintf, to ensure we can't overrun the
supplied buffer.  (Unlikely, but let's be safe.)

Per buildfarm.

Files

PathChange+/−
src/interfaces/libpq/fe-trace.c modified +3 −6