From 87e6f0008870a9e6a78041c4b6c6d7fc6f856264 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Thu, 10 Mar 2022 17:35:59 +0100 Subject: [PATCH] auth, rec, dnsdist: check strftime return value for logging timestamps --- pdns/dolog.hh | 4 +++- pdns/logger.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pdns/dolog.hh b/pdns/dolog.hh index fd6097dd10..3c5237a5bd 100644 --- a/pdns/dolog.hh +++ b/pdns/dolog.hh @@ -103,7 +103,9 @@ void genlog(int level, const char* s, Args... args) time_t t; time(&t); localtime_r(&t, &tm); - strftime(buffer, sizeof(buffer), "%b %d %H:%M:%S ", &tm); + if (strftime(buffer, sizeof(buffer), "%b %d %H:%M:%S ", &tm) == 0) { + buffer[0] = '\0'; + } std::cout<