STINNER Victor added the comment: > 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/ ---------- nosy: +haypo _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16201> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com