[issue22282] ipaddress module accepts octal formatted IPv4 addresses in IPv6 addresses

Fabian report at bugs.python.org
Wed Aug 27 11:33:26 CEST 2014


New submission from Fabian:

The ipaddress module accepts IPv6 addresses if the IPv4 address is formatted as an octal number, but http://tools.ietf.org/html/rfc3986#section-3.2.2 doesn't allow leading zeroes in the IPv4 address.

This is the current behaviour (in 3.4.1):

>>> ipaddress.ip_address("::1.0.0.00")
IPv6Address('::100:0')

Expected:

>>> ipaddress.ip_address("::1.0.0.00")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "3.4.1/lib/python3.4/ipaddress.py", line 54, in ip_address
    address)
ValueError: '::1.0.0.00' does not appear to be an IPv4 or IPv6 address

Because I didn't know it better, I first tried to patch the backport but this might be still applicable the official code: https://github.com/phihag/ipaddress/pull/12

----------
messages: 225950
nosy: xZise
priority: normal
severity: normal
status: open
title: ipaddress module accepts octal formatted IPv4 addresses in IPv6 addresses
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22282>
_______________________________________


More information about the Python-bugs-list mailing list