[tor-commits] [flashproxy/master] Check in format_addr for port being in bounds.
dcf at torproject.org
dcf at torproject.org
Fri Aug 31 11:39:36 UTC 2012
commit 21baa03e8e49c9ccc652dced476f0171e864999d
Author: David Fifield <david at bamsoftware.com>
Date: Sat Jul 28 09:18:03 2012 -0700
Check in format_addr for port being in bounds.
---
fac.py | 2 ++
facilitator-test | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/fac.py b/fac.py
index 8cf030d..bace28c 100644
--- a/fac.py
+++ b/fac.py
@@ -52,6 +52,8 @@ def format_addr(addr):
else:
host_str = u"%s" % host
if port is not None:
+ if not (0 < port <= 65535):
+ raise ValueError("port must be between 1 and 65535 (is %d)" % port)
port_str = u":%d" % port
if not host_str and not port_str:
diff --git a/facilitator-test b/facilitator-test
index 35bb018..4e37dd1 100755
--- a/facilitator-test
+++ b/facilitator-test
@@ -22,7 +22,7 @@ class FacilitatorTest(unittest.TestCase):
return gimme_socket(FACILITATOR_HOST, FACILITATOR_PORT)
def setUp(self):
- self.process = subprocess.Popen(["./facilitator", "-d", "-p", str(FACILITATOR_PORT), "-r", "0.0.0.0:0", "-l", "/dev/null"])
+ self.process = subprocess.Popen(["./facilitator", "-d", "-p", str(FACILITATOR_PORT), "-r", "0.0.1.0:1", "-l", "/dev/null"])
time.sleep(0.1)
def tearDown(self):
More information about the tor-commits
mailing list