]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-143010: Prevent a TOCTOU issue by only calling open once (GH-143011) (...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 22 Dec 2025 18:14:59 +0000 (19:14 +0100)
committerGitHub <noreply@github.com>
Mon, 22 Dec 2025 18:14:59 +0000 (13:14 -0500)
commit33c9ebe437064ae5066767128e94c2fc9e388a50
treeae3bc1a19a7c8a7ba767d248b7597ee32ab053e3
parent98f6db7e82454fec596a0fced7d5d5ef297281cc
[3.14] gh-143010: Prevent a TOCTOU issue by only calling open once (GH-143011) (#143080)

gh-143010: Prevent a TOCTOU issue by only calling open once (GH-143011)

RDM: per  AZero13's research the 'x' option did not exist when this code was written,  This
modernization can thus drop the fd trick in _create_carefully and just use open with 'x' to achieve the same goal more securely.
(cherry picked from commit a88d1b8dab4cbd3180dd7f1acb44d627db90323b)

Co-authored-by: AZero13 <gfunni234@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/mailbox.py
Misc/NEWS.d/next/Library/2025-12-20-01-49-02.gh-issue-143010._-SWX0.rst [new file with mode: 0644]