Opened 7 weeks ago

Last modified 5 weeks ago

#22245 merge_ready defect

Logic error with monthly accounting

Reported by: arma Owned by:
Priority: Medium Milestone: Tor: 0.3.0.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 029-backport, 030-backport
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Here's the code in src/or/hibernate.c:

      /* 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_mon;
      }

Andrey Karpov points out in https://www.viva64.com/en/b/0507/ that the second clause of the if is redundant with the first clause.

Looking at it more, I think we wanted that second clause to be (tm.tm_mday == cfg_start_day && before).

What are the implications of this bug for relays that do monthly accounting?

Child Tickets

Change History (4)

comment:1 in reply to: ↑ description Changed 6 weeks ago by teor

Replying to arma:

What are the implications of this bug for relays that do monthly accounting?

Tor rolls over all monthly accounting at 00:00, rather than the configured hour and minute.

comment:2 Changed 6 weeks ago by nickm

  • Keywords 029-backport 030-backport added
  • Milestone changed from Tor: 0.3.1.x-final to Tor: 0.3.0.x-final
  • Status changed from new to needs_review

I've made the suggested fix in a branch bug22245_024. I suggest that we backport no farther than 0.2.9. I've merged this in master. Marking for possible backport

comment:3 Changed 5 weeks ago by nickm

  • Status changed from needs_review to merge_ready

comment:4 Changed 5 weeks ago by nickm

  • Keywords changed from 029-backport 030-backport to 029-backport, 030-backport
Note: See TracTickets for help on using tickets.