gh-42400: Fix buffer overflow in _Py_wrealpath for long paths#141529
gh-42400: Fix buffer overflow in _Py_wrealpath for long paths#141529vstinner merged 8 commits intopython:mainfrom
Conversation
1424245 to
3255a3d
Compare
52f60a5 to
bb4af8a
Compare
Allow platforms where realpath returns different canonical paths (e.g. Android). Verify resolution with os.samefile and fall back to a length check if samefile is unavailable.
|
I don't think the errors in the UBSAN test are related to this fix, as they occur for a completely different reason and generally in import tests. |
|
@vstinner Could you please review this PR? |
…qB5Kq.rst Co-authored-by: Victor Stinner <vstinner@python.org>
|
I updated the PR to retrieve the fix for the UBSan CI. |
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit f882e26 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F141529%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
|
|
|
Change merged, thanks. The change passed on our fleet of stable buildbots. Even if the change was documented in the Security category, I don't think that it's worth it to backport it to stable branches (yet). I'm afraid of breaking the Python build on some weird platforms where |
…paths (python#141529) Co-authored-by: Victor Stinner <vstinner@python.org>
Fixes buffer overflow (CVE-2006-1542) in
_Py_wrealpath()when handling paths longer than MAXPATHLEN (4096 bytes).Changed
realpath(path, buffer)torealpath(path, NULL)for dynamic allocation.Closes #42400
realpath#42400