New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-44493: Add missing terminated NUL in sockaddr_un's length #26866
base: main
Are you sure you want to change the base?
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
This PR is stale because it has been open for 30 days with no activity. |
9d52974
to
f6c4adc
Compare
Can anyone review this PR? |
d96470f
to
75a4ce9
Compare
Can anyone review this PR? |
I too am now facing this same issue. How can it be moved along? |
I can't believe this missed the 3.10 release. :( |
This comment has been minimized.
This comment has been minimized.
I'm temporarily locking this PR to prevent further abuse. The issue on BPO hasn't been triaged because it lacks any sort of description of the issue. You should provide an explanation why you consider the code to be wrong. A reproducer is greatly appreciated. The change set also needs a test case. PS: In case you wonder where the maintainers are, two are currently in the middle of a war zone and the others are worried for their lives. |
LGTM.
I think it is difficult to write any tests for this, right?
A regression test seems doable and potentially important if I understand this bug correctly:
It looks like the length would be short by one in Python before this change, meaning binding to a AF_UNIX socket potentially loses the last character of the path name intended to be bound?
That should be an observable behavior change.
It also suggests that fixing this will break code that has been working around this bug forever by adding an extra character when binding or connecting to a non-anonymous AF_UNIX socket?
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
I do not sure that it can be easily testes. Otherwise the tests would fail long time ago. |
Yes. That's why I didn't add an unit test for this change. Because Python itself didn't care about the length of cpython/Modules/socketmodule.c Lines 1320 to 1336 in b68431f
But if one of the server or client was written in other language, for example in this case, I started a server in Rust and connected it with a Python client binding to It can also easily reproduce with C clients or servers. I think the key of making tests is to verify the |
One more thing that I have already mentioned in https://bugs.python.org/issue44493 : The OS doesn't care the correctness of And this bug will become very obvious when using |
pretty esoteric and hard to reproduce issue, at least from Python due to the mix and match of sometimes C string and sometimes strict length use around these old hand wavy APIs. agreed that constructing a test is hard. I suggested an assertion that would catch it. not what I'd call pretty though. So if you don't want that, I'm still good with this PR. |
All done. |
BTW, the Should we set this field if it exists? #ifdef SUN_LEN
addr->sun_len = SUN_LEN(addr);
#endif or #ifdef SUN_LEN
addr->sun_len = *len_ret;
#endif |
Oh, @gpshead . It seems that the force push I just made have removed a commit from you. What change did you made? Move a comment? |
Please use See also Eric's excellent #31616 (comment) about force-pushing. |
Yes, but I have already force pushed. I will use merge next time. |
yeah all i did was address the comment move request. |
Done. |
@zonyitoo: Status check is done, and it's a failure |
The test fluked on |
https://bugs.python.org/issue44493
Automerge-Triggered-By: GH:gpshead