From c5cf5c885e7b913b3a294a04a97ec1c923b924cd Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 1 Jan 2020 17:19:14 +0000 Subject: [PATCH] pivot-table: Avoid ctime_r() for portability reasons. ctime_r() isn't in mingw or Gnulib and it's best to avoid it in any case because POSIX says it is obsolescent and it has buffer overflow issues. Reported by Harry Thijssen. --- src/output/pivot-table.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index 031656227b..924a14cc9b 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -1487,8 +1487,11 @@ pivot_table_dump (const struct pivot_table *table, int indentation) if (table->date) { indent (indentation); - char buf[26]; - printf ("date: %s", ctime_r (&table->date, buf)); + + struct tm *tm = localtime (&table->date); + printf ("date: %d-%02d-%02d %d:%02d:%02d\n", tm->tm_year + 1900, + tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, + tm->tm_sec); } indent (indentation); -- 2.30.2