8000 gh-99889: Fix directory traversal security flaw in uu.decode() by samcarroll42 · Pull Request #104096 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-99889: Fix directory traversal security flaw in uu.decode() #104096

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

Merged
merged 6 commits into from
May 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-99889: Fix directory traversal security flaw in uu.decode()
  • Loading branch information
samcarroll42 committed May 2, 2023
commit 087561fd4945a93b8c9b35e0ffc3a9fe4de1a5a8
2 changes: 2 additions & 0 deletions Lib/uu.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def decode(in_file, out_file=None, mode=None, quiet=False):
out_file = hdrfields[2].rstrip(b' \t\r\n\f').decode("ascii")
if os.path.exists(out_file):
raise Error('Cannot overwrite existing file: %s' % out_file)
if '../' in out_file:
raise Error('Writing to %s would result in directory traversal' % out_file)
if mode is None:
mode = int(hdrfields[1], 8)
#
Expand Down
0