* use snprintf
authorWilfried Göesgens <willi@citadel.org>
Tue, 15 Jan 2008 23:07:06 +0000 (23:07 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 15 Jan 2008 23:07:06 +0000 (23:07 +0000)
* if TZ environment variable is unset, set UTC, so valgrind finaly shuts up on all our date/time printing functions.

webcit/fmt_date.c
webcit/webserver.c

index 3289fac0ae4f2af719cfdf6aa4626c6cef49caad..c01f8778e286ef5ecc3e3f9e099af4b0ee30862c 100644 (file)
@@ -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");
index 4d64727922ff6ba22af10220fd7271e66b8b03b5..82d9e396cce9629bc7c02ca305f7762dd4ff2e45 100644 (file)
@@ -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)