Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #9007
Closed (moved) (moved)
Open
Issue created Jun 01, 2013 by Trac@tracbot

TorBulkExitList.py doesn't support all ports (patch included)

https://svn.torproject.org/svn/check/trunk/cgi-bin/TorBulkExitList.py

has this block:

    # Verify that the port is a number between 1 and 65535
    # Otherwise return a sane default of 80
    search = re.compile("^(?:[1-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|"+\
                            "65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$")

The comment is wrong; unfortunately; the regex fails for 4-digit-or-less numbers that contain 0, such as 8000, 102, or even 80. The only reason it supports port 80 at all is because it's the default. It declares port 80 invalid and uses the default of port 80 instead.

The least invasive fix would be to replace the third line with:

    search = re.compile("^(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|"+\

Which makes the regex do what the comment suggests.

A better solution would be to use something other than a regex to determine if a number is in a range, but I'll leave that as an exercise for the reader. :P

Trac:
Username: Zarel

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking