summaryrefslogtreecommitdiff
path: root/django/utils/text.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-02-24 16:22:43 -0500
committerTim Graham <timograham@gmail.com>2018-03-01 11:58:41 -0500
commitd17974a287a6ea2e361daff88fcc004cbd6835fa (patch)
treed011b72a61adfe4f006af2a47212f0d0e78ba6c4 /django/utils/text.py
parent1ca63a66ef3163149ad822701273e8a1844192c2 (diff)
[1.8.x] Fixed CVE-2018-7537 -- Fixed catastrophic backtracking in django.utils.text.Truncator.
Thanks James Davis for suggesting the fix.
Diffstat (limited to 'django/utils/text.py')
-rw-r--r--django/utils/text.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/utils/text.py b/django/utils/text.py
index eb66b77578..49b6d91fb0 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -27,7 +27,7 @@ capfirst = allow_lazy(capfirst, six.text_type)
# Set up regular expressions
re_words = re.compile(r'<.*?>|((?:\w[-\w]*|&.*?;)+)', re.U | re.S)
re_chars = re.compile(r'<.*?>|(.)', re.U | re.S)
-re_tag = re.compile(r'<(/)?([^ ]+?)(?:(\s*/)| .*?)?>', re.S)
+re_tag = re.compile(r'<(/)?(\S+?)(?:(\s*/)|\s.*?)?>', re.S)
re_newlines = re.compile(r'\r\n|\r') # Used in normalize_newlines
re_camel_case = re.compile(r'(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))')