Patches item #1754489, was opened at 2007-07-16 01:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1754489&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Vlado Handziski (vlahan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Non-portable address length calculation for AF_UNIX sockets

Initial Comment:
The calculation of the address length for AF_UNIX sockets in the getsockaddrarg 
function in socketmodule.c returns wrong values on platforms with padded struct 
sockaddr_un:

*len_ret = len + sizeof(*addr) - sizeof(addr->sun_path);

sizeof(*addr) is for example 112 on an ARM (NSLU2) platforms, while it is 110 
on a i386 PC.

The correct way to calculate the length is by directly using the offset of the 
sun_path field:

*len_ret = len + offsetof(struct sockaddr_un, sun_path);

as suggested in the GNU libc manual:

http://www.gnu.org/software/libc/manual/html_node/Local-Socket-Example.html

The correction also needs to be applied to the makesockaddr function when 
reversing the above addition in the case of abstract namespace sockets on linux.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1754489&group_id=5470
_______________________________________________
Patches mailing list
Patches@python.org
http://mail.python.org/mailman/listinfo/patches

Reply via email to