[Python-bugs-list] [ python-Bugs-669859 ] socket.inet_aton() succeeds on invalid input

SourceForge.net noreply@sourceforge.net
Sun, 19 Jan 2003 09:38:41 -0800


Bugs item #669859, was opened at 2003-01-17 18:49
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=669859&group_id=5470

Category: Python Library
Group: Python 2.2
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Matt Beaumont (mbeaumon)
Assigned to: Nobody/Anonymous (nobody)
Summary: socket.inet_aton() succeeds on invalid input

Initial Comment:
Given a string such as "5.6.7", inet_aton() returns
'\x05\x06\x00\x07'.  In C (using libraries installed
with RedHat 7.2), the equivalent call returns 0,
indicating that the address is invalid.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2003-01-19 18:38

Message:
Logged In: YES 
user_id=21627

I can't see the problem. First, 5.6.7 is really a valid
denotation of an IP number, and denotes the IP address
5.6.0.7, just like 10.13 denotes 10.0.0.13.

Furthermore, Python uses inet_addr on the C level, which
does not return a status; for the address given, it returns
exactly the same result that you see in Python.

Finally, I cannot reproduce inet_aton(3) returning an error:
on my installation (SuSE 8.1), it returns 1, indicating success.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=669859&group_id=5470