]> granicus.if.org Git - apache/commitdiff
* support/rotatelogs.c (get_now): Fix the NULL ptr dereferences
authorJoe Orton <jorton@apache.org>
Tue, 15 Oct 2013 11:19:38 +0000 (11:19 +0000)
committerJoe Orton <jorton@apache.org>
Tue, 15 Oct 2013 11:19:38 +0000 (11:19 +0000)
  added in r1532281.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1532289 13f79535-47bb-0310-9956-ffa450edef68

support/rotatelogs.c

index b22110cfc28dff7efc2add06b2b396175b9db66e..7c203e59df462eb88e4298242828082c2f357634 100644 (file)
@@ -156,6 +156,7 @@ static void usage(const char *argv0, const char *reason)
 static int get_now(rotate_config_t *config, apr_int32_t *offset)
 {
     apr_time_t tNow = apr_time_now();
+    int utc_offset;
 
     if (config->use_localtime) {
         /* Check for our UTC offset before using it, since it might
@@ -164,13 +165,16 @@ static int get_now(rotate_config_t *config, apr_int32_t *offset)
          */
         apr_time_exp_t lt;
         apr_time_exp_lt(&lt, tNow);
-        *offset = lt.tm_gmtoff;
+        utc_offset = lt.tm_gmtoff;
     }
     else {
-        *offset = config->utc_offset;
+        utc_offset = config->utc_offset;
     }
 
-    return (int)apr_time_sec(tNow) + *offset;
+    if (offset)
+        *offset = utc_offset;
+
+    return (int)apr_time_sec(tNow) + utc_offset;
 }
 
 /*