This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author baikie
Recipients baikie, loewis, pitrou, vstinner
Date 2010-09-06.16:42:13
SpamBayes Score 9.116696e-11
Marked as misclassified No
Message-id <>
In-reply-to <>
> baikie, coming back to your original message: what precisely makes you believe that sun_path does not need to be null-terminated on Linux?

That's the way I demonstrated the bug - the only way to bind to a
108-byte path is to pass it without null termination, because
Linux will not accept an oversized sockaddr_un structure (e.g. a
108-byte path plus null terminator).  Also, unless it's on OS/2,
Python's existing code never includes the null terminator in the
address size it passes to the system call, so a correctly-
behaving OS should never see it.

However, it does now occur to me that a replacement libc
implementation for Linux could try to do something with sun_path
during the call and assume it's null-terminated even though the
kernel doesn't, so it may be best to keep the null termination
requirement after all.  In that case, there would be no way to
test for the bug from within Python, so the test problems would
be somewhat moot (although the test code could still be used by
changing UNIX_PATH_MAX from 108 to 107).

Attaching four-space-indent versions of the original patches (for
2.x and 3.x), and tests incorporating Antoine's use of
File name Uploaded
addrlen-2.x-4spc.diff baikie, 2010-09-06.16:42:12
addrlen-3.x-4spc.diff baikie, 2010-09-06.16:42:12
linux-pass-unterminated-4spc.diff baikie, 2010-09-06.16:42:11
return-unterminated-2.x-4spc.diff baikie, 2010-09-06.16:42:11
return-unterminated-3.x-4spc.diff baikie, 2010-09-06.16:42:11
test-2.x-new.diff baikie, 2010-09-06.16:42:12
test-3.x-new.diff baikie, 2010-09-06.16:42:13
Date User Action Args
2010-09-06 16:42:16baikiesetrecipients: + baikie, loewis, pitrou, vstinner
2010-09-06 16:42:14baikielinkissue8372 messages
2010-09-06 16:42:13baikiecreate