Skip to content

Commit

Permalink
Prevent directory traversal attacks
Browse files Browse the repository at this point in the history
  • Loading branch information
beavailable committed Oct 19, 2022
1 parent 072f1b1 commit d21b970
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion share.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def handle_multipart(self, save_dir, redirect_location):
if not filename:
self.respond_bad_request()
return
with open(f'{save_dir}/{filename}', 'wb') as f:
with open(f'{save_dir}/{os.path.basename(filename)}', 'wb') as f:
parser.write_next_to(f)
except MultipartError:
self.respond_bad_request()
Expand Down

0 comments on commit d21b970

Please sign in to comment.