diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-05-24 21:54:34 +0800 |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-05-24 21:54:34 +0800 |
commit | 37484dc324b442d1fdab10f05f657cef80845279 (patch) | |
tree | 97a52c7235afcb348b7d9d614402a187fe108c18 /Lib/urlparse.py | |
parent | cd8799f077d236a06a86a9cf707de2a246fb800d (diff) | |
download | cpython-git-37484dc324b442d1fdab10f05f657cef80845279.tar.gz |
Issue #14036: return None when port in urlparse cross 65535
Diffstat (limited to 'Lib/urlparse.py')
-rw-r--r-- | Lib/urlparse.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py index 4c57725ce3..8a20756503 100644 --- a/Lib/urlparse.py +++ b/Lib/urlparse.py @@ -97,9 +97,11 @@ class ResultMixin(object): netloc = self.netloc.split('@')[-1].split(']')[-1] if ':' in netloc: port = netloc.split(':')[1] - return int(port, 10) - else: - return None + port = int(port, 10) + # verify legal port + if (0 <= port <= 65535): + return port + return None from collections import namedtuple |