[issue8882] socketmodule.c`getsockaddrarg() should not check the length of sun_path

Edward Pilatowicz report at bugs.python.org
Sat Jun 5 02:53:01 CEST 2010


Edward Pilatowicz <edward.pilatowicz at oracle.com> added the comment:

some additional data.

AIX 6.1:
    defined sun_path = 1023
    max sun_path = 1023

i'll also point out the existence of the SUN_LEN() macro, which is
defined on all the previously mentioned operating systems, and which
calculates the size of a sockaddr_un structure using strlen() of
sun_path, not sizeof().

that said, as a counter argument, UNIX Network Programming by Richard
Stevens explicitly mentions that the use of sizeof() is ok.

still, personally, i think it's pretty risky for an OS to change this
definition.  (it seems that AIX is the only OS i've seen that has done
so.)  i say this because use of the sockaddr_un structure is so
prevalent.  it's commonly embedded into other structures and passed
around via APIs that (unlike bind(), connect(), etc) don't take a size
parameter which specifies the size of the structure.

----------

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


More information about the Python-bugs-list mailing list