Skip to content

mod.dronescan: the per-IP join-flood pacing check has its operands reversed #96

Description

@MrIron-no

mod.dronescan/dronescan.cc:1586:

if ((unsigned int)(jcFCInterval - ::time(0)) >= jcJoinsPerIPTime) {

jcFCInterval is a static initialised to ::time(0) (dronescan.cc:1325) and is only ever reassigned to ::time(0) inside this same block (dronescan.cc:1588). It is therefore always less than or equal to ::time(0) when the check runs, so jcFCInterval - ::time(0) is always <= 0. Cast to unsigned int, that is either 0 — within the same second — or wraps to a value near 4.29e9, which exceeds any realistic configured jcJoinsPerIPTime.

Effect: the per-IP join sweep is skipped only within the same second and otherwise runs on essentially every pass, rather than once every jcJoinsPerIPTime seconds as the reset-then-compare structure implies.

The operands appear to be reversed. Fix: (::time(0) - jcFCInterval) >= jcJoinsPerIPTime.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions