Blame SOURCES/CVE-2019-11236.patch

69f732
From b40eb0f43daecc6e2e3ce47b0be49cf570d02adc Mon Sep 17 00:00:00 2001
69f732
From: Lumir Balhar <lbalhar@redhat.com>
69f732
Date: Thu, 9 Jan 2020 11:14:58 +0100
69f732
Subject: [PATCH] CVE-2019-9740
69f732
69f732
---
69f732
 util/url.py | 7 +++++++
69f732
 1 file changed, 7 insertions(+)
69f732
69f732
diff --git a/util/url.py b/util/url.py
69f732
index 6b6f996..2784c85 100644
69f732
--- a/util/url.py
69f732
+++ b/util/url.py
69f732
@@ -1,5 +1,6 @@
69f732
 from __future__ import absolute_import
69f732
 from collections import namedtuple
69f732
+import re
69f732
 
69f732
 from ..exceptions import LocationParseError
69f732
 
69f732
@@ -10,6 +11,8 @@ url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
69f732
 # urllib3 infers URLs without a scheme (None) to be http.
69f732
 NORMALIZABLE_SCHEMES = ('http', 'https', None)
69f732
 
69f732
+_contains_disallowed_url_pchar_re = re.compile('[\x00-\x20\x7f]')
69f732
+from ..packages.six.moves.urllib.parse import quote
69f732
 
69f732
 class Url(namedtuple('Url', url_attrs)):
69f732
     """
69f732
@@ -155,6 +158,10 @@ def parse_url(url):
69f732
         # Empty
69f732
         return Url()
69f732
 
69f732
+    # Prevent CVE-2019-9740.
69f732
+    # adapted from https://github.com/python/cpython/pull/12755
69f732
+    url = _contains_disallowed_url_pchar_re.sub(lambda match: quote(match.group()), url)
69f732
+
69f732
     scheme = None
69f732
     auth = None
69f732
     host = None
69f732
-- 
69f732
2.24.1
69f732