summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/request.py
diff options
context:
space:
mode:
authorMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>2020-10-20 07:17:58 (GMT)
committerGitHub <noreply@github.com>2020-10-20 07:17:58 (GMT)
commite7c5a43984f82ef9634cb0b2b8c4750b2fd431a0 (patch)
treed5a82fc51c3700ae6e7bd09803d8440fdc037bed /Lib/urllib/request.py
parent65894cac0835cb8f469f649e20aa1be8bf89f5ae (diff)
downloadcpython-e7c5a43984f82ef9634cb0b2b8c4750b2fd431a0.zip
cpython-e7c5a43984f82ef9634cb0b2b8c4750b2fd431a0.tar.gz
cpython-e7c5a43984f82ef9634cb0b2b8c4750b2fd431a0.tar.bz2
bpo-41471: Ignore invalid prefix lengths in system proxy settings on macOS (GH-22762) (GH-22774)
(cherry picked from commit 93a1ccabdede416425473329b8c718d507c55e29) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Diffstat (limited to 'Lib/urllib/request.py')
-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 e440738..afd6341 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2604,6 +2604,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):