summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/ipv6.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/django/utils/ipv6.py b/django/utils/ipv6.py
index a0cd606043..4f433d198b 100644
--- a/django/utils/ipv6.py
+++ b/django/utils/ipv6.py
@@ -1,6 +1,8 @@
# This code was mostly based on ipaddr-py
# Copyright 2007 Google Inc. https://github.com/google/ipaddr-py
# Licensed under the Apache License, Version 2.0 (the "License").
+import re
+
from django.core.exceptions import ValidationError
from django.utils.six.moves import range
from django.utils.translation import ugettext_lazy as _
@@ -155,6 +157,10 @@ def is_valid_ipv6_address(ip_str):
"""
from django.core.validators import validate_ipv4_address
+ symbols_re = re.compile(r'^[0-9a-fA-F:.]+$')
+ if not symbols_re.match(ip_str):
+ return False
+
# We need to have at least one ':'.
if ':' not in ip_str:
return False