From a1498170742e72a6c868a8be94d859a2c21ad165 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Tue, 15 Jan 2008 23:07:06 +0000 Subject: [PATCH] * use snprintf * if TZ environment variable is unset, set UTC, so valgrind finaly shuts up on all our date/time printing functions. --- webcit/fmt_date.c | 2 +- webcit/webserver.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/webcit/fmt_date.c b/webcit/fmt_date.c index 3289fac0a..c01f8778e 100644 --- a/webcit/fmt_date.c +++ b/webcit/fmt_date.c @@ -225,7 +225,7 @@ time_t httpdate_to_timestamp(char *buf) /** Got everything; let's go */ /** First, change to UTC */ if (getenv("TZ")) - sprintf(tz, "TZ=%s", getenv("TZ")); + snprintf(tz, 256, "TZ=%s", getenv("TZ")); else strcpy(tz, "TZ="); putenv("TZ=UTC"); diff --git a/webcit/webserver.c b/webcit/webserver.c index 4d6472792..82d9e396c 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -662,6 +662,9 @@ int main(int argc, char **argv) strcpy(uds_listen_path, ""); + if (getenv("TZ") == NULL) + putenv("TZ=UTC"); + /** Parse command line */ #ifdef HAVE_OPENSSL while ((a = getopt(argc, argv, "h:i:p:t:x:dD:cfs")) != EOF) -- 2.30.2