Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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