[New-bugs-announce] [issue16201] socket.gethostbyname incorrectly parses ip

Michele Orrù report at bugs.python.org
Thu Oct 11 21:31:03 CEST 2012


New submission from Michele Orrù:

Buggy due to the use of scanf at Modueles/socketmodule.c:868
Broken from python2.7 to tip on my machine (GNU/Linux)

>>> import socket
[64481 refs]
>>> socket.gethostbyname('4294967306.4294967296.4294967296.1')
'10.0.0.1'
[67764 refs]
>>> socket.gethostbyname('192.168.1.1  ')
'192.168.1.1'
[67764 refs]
>>> socket.gethostbyname('  192.168.1.1')
'192.168.1.1'
[67764 refs]
>>> socket.gethostbyname('  192.168.1.1  ')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: [Errno -2] Name or service not known
[67805 refs]

----------
components: Library (Lib)
messages: 172682
nosy: maker
priority: normal
severity: normal
status: open
title: socket.gethostbyname incorrectly parses ip
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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


More information about the New-bugs-announce mailing list