Merge "Prevent potential ReDoS attack"
This commit is contained in:
@@ -422,11 +422,11 @@ return 1
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _parse_sentinel(cls, sentinel):
|
def _parse_sentinel(cls, sentinel):
|
||||||
# IPv6 (eg. [::1]:6379 )
|
# IPv6 (eg. [::1]:6379 )
|
||||||
match = re.search(r'\[(\S+)\]:(\d+)', sentinel)
|
match = re.search(r'^\[(\S+)\]:(\d+)$', sentinel)
|
||||||
if match:
|
if match:
|
||||||
return (match[1], int(match[2]))
|
return (match[1], int(match[2]))
|
||||||
# IPv4 or hostname (eg. 127.0.0.1:6379 or localhost:6379)
|
# IPv4 or hostname (eg. 127.0.0.1:6379 or localhost:6379)
|
||||||
match = re.search(r'(\S+):(\d+)', sentinel)
|
match = re.search(r'^(\S+):(\d+)$', sentinel)
|
||||||
if match:
|
if match:
|
||||||
return (match[1], int(match[2]))
|
return (match[1], int(match[2]))
|
||||||
raise ValueError('Malformed sentinel server format')
|
raise ValueError('Malformed sentinel server format')
|
||||||
|
Reference in New Issue
Block a user