Message172787
> Buggy due to the use of scanf at Modueles/socketmodule.c:868
I don't think so. The following test fails because sscanf() returns 5 instead of 4:
if (sscanf(name, "%d.%d.%d.%d%c", &d1, &d2, &d3, &d4, &ch) == 4 && ...)
So '192.168.1.1 ' is passed to getaddrinfo().
If you consider that '192.168.1.1 ' is an invalid name, you should report the issue to the vendor of the C library of your OS.
--
On Linux, the "issue" is also present in inet_ntoa():
$ python
Python 2.7.3 (default, Jul 24 2012, 11:41:40)
[GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux2
>>> import ctypes
>>> buffer=ctypes.create_string_buffer(128)
>>> libc=ctypes.cdll.LoadLibrary("libc.so.6")
>>> libc.inet_aton(b"127.0.0.1", ctypes.byref(buffer))
1
>>> buffer.raw[:4]
'\x7f\x00\x00\x01'
>>> libc.inet_aton(b"127.0.0.2 ", ctypes.byref(buffer))
1
>>> buffer.raw[:4]
'\x7f\x00\x00\x02'
The source code of the inet_aton() function of the GNU libc:
http://sourceware.org/git/?p=glibc.git;a=blob;f=resolv/inet_addr.c;h=144b87a74c1aef62779862e78e5f87e18e66ee9e;hb=HEAD#l108
Website of the GNU libc:
http://www.gnu.org/software/libc/ |
|
Date |
User |
Action |
Args |
2012-10-12 21:59:41 | vstinner | set | recipients:
+ vstinner, ezio.melotti, santoso.wijaya, maker |
2012-10-12 21:59:41 | vstinner | set | messageid: <1350079181.53.0.65104086427.issue16201@psf.upfronthosting.co.za> |
2012-10-12 21:59:41 | vstinner | link | issue16201 messages |
2012-10-12 21:59:41 | vstinner | create | |
|