mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
[1.8.x] Fixed catastrophic backtracking in URLValidator.
Thanks João Silva for reporting the problem and Tim Graham for finding the problematic RE and for review. This is a security fix; disclosure to follow shortly.
This commit is contained in:
@@ -73,7 +73,7 @@ class URLValidator(RegexValidator):
|
||||
|
||||
# Host patterns
|
||||
hostname_re = r'[a-z' + ul + r'0-9](?:[a-z' + ul + r'0-9-]*[a-z' + ul + r'0-9])?'
|
||||
domain_re = r'(?:\.[a-z' + ul + r'0-9]+(?:[a-z' + ul + r'0-9-]*[a-z' + ul + r'0-9]+)*)*'
|
||||
domain_re = r'(?:\.(?!-)[a-z' + ul + r'0-9-]*(?<!-))*'
|
||||
tld_re = r'\.(?:[a-z' + ul + r']{2,}|xn--[a-z0-9]+)\.?'
|
||||
host_re = '(' + hostname_re + domain_re + tld_re + '|localhost)'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user