]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a logic error in hibernate.c
authorNick Mathewson <nickm@torproject.org>
Mon, 15 May 2017 15:43:18 +0000 (11:43 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 15 May 2017 15:43:18 +0000 (11:43 -0400)
Closes bug 22245; bugfix on 0.0.9rc1, when bandwidth accounting was
first introduced.

Found by Andrey Karpov and reported at https://www.viva64.com/en/b/0507/

changes/bug22245 [new file with mode: 0644]
src/or/hibernate.c

diff --git a/changes/bug22245 b/changes/bug22245
new file mode 100644 (file)
index 0000000..6ae1859
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (bandwidth accounting):
+    - Roll over monthly accounting at the configured hour and minute,
+      rather than always at 00:00.
+      Fixes bug 22245; bugfix on 0.0.9rc1.
+      Found by Andrey Karpov with PVS-Studio.
index a412571331cb353b1ad1d1bb94e03c66d8fd1b12..e5ed3d4119544bc09665a12d506c0556321081d8 100644 (file)
@@ -290,7 +290,7 @@ edge_of_accounting_period_containing(time_t now, int get_end)
     case UNIT_MONTH: {
       /* If this is before the Nth, we want the Nth of last month. */
       if (tm.tm_mday < cfg_start_day ||
-          (tm.tm_mday < cfg_start_day && before)) {
+          (tm.tm_mday == cfg_start_day && before)) {
         --tm.tm_mon;
       }
       /* Otherwise, the month is correct. */