mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Fixed an infinite loop possibility in strip_tags().
This is a security fix; disclosure to follow shortly.
This commit is contained in:
@@ -175,8 +175,10 @@ def strip_tags(value):
|
||||
# is redundant, but helps to reduce number of executions of _strip_once.
|
||||
while '<' in value and '>' in value:
|
||||
new_value = _strip_once(value)
|
||||
if new_value == value:
|
||||
# _strip_once was not able to detect more tags
|
||||
if len(new_value) >= len(value):
|
||||
# _strip_once was not able to detect more tags or length increased
|
||||
# due to http://bugs.python.org/issue20288
|
||||
# (affects Python 2 < 2.7.7 and Python 3 < 3.3.5)
|
||||
break
|
||||
value = new_value
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user