summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2020-10-19 18:16:21 (GMT)
committerGitHub <noreply@github.com>2020-10-19 18:16:21 (GMT)
commit93a1ccabdede416425473329b8c718d507c55e29 (patch)
treedaa75975185560298a093d79ac213834881a0064 /Lib/urllib
parent05ee790f4d1cd8725a90b54268fc1dfe5b4d1fa2 (diff)
downloadcpython-93a1ccabdede416425473329b8c718d507c55e29.zip
cpython-93a1ccabdede416425473329b8c718d507c55e29.tar.gz
cpython-93a1ccabdede416425473329b8c718d507c55e29.tar.bz2
bpo-41471: Ignore invalid prefix lengths in system proxy settings on macOS (GH-22762)
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/request.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 2a3d715..a8c870b 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2596,6 +2596,11 @@ def _proxy_bypass_macosx_sysconf(host, proxy_settings):
mask = 8 * (m.group(1).count('.') + 1)
else:
mask = int(mask[1:])
+
+ if mask < 0 or mask > 32:
+ # System libraries ignore invalid prefix lengths
+ continue
+
mask = 32 - mask
if (hostIP >> mask) == (base >> mask):