From: Peter van Dijk Date: Thu, 10 Mar 2022 16:35:59 +0000 (+0100) Subject: auth, rec, dnsdist: check strftime return value for logging timestamps X-Git-Tag: rec-4.7.0-beta1~68^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11388%2Fhead;p=thirdparty%2Fpdns.git auth, rec, dnsdist: check strftime return value for logging timestamps --- 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<