From 2fc5a5080923f243a78b13cca0fd09f8db26eff6 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Thu, 24 May 2012 21:56:17 +0800 Subject: Issue #14036: return None when port in urlparse cross 65535 --- Lib/urllib/parse.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/urllib/parse.py') diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 92170ad0a2..528c0a7aaf 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -143,6 +143,9 @@ class _NetlocResultMixinBase(object): port = self._hostinfo[1] if port is not None: port = int(port, 10) + # Return None on an illegal port + if not ( 0 <= port <= 65535): + return None return port -- cgit v1.2.1