Skip to content

Commit

Permalink
refactor recursive deletion into a struct maintaining the dir stack
Browse files Browse the repository at this point in the history
it can remove arbitrarily-deep directory trees without exhausting
the stack or file descriptor limits.
The symlink attack/TOCTOU from CVE-2022-21658 that can occur when
traversing the directory hierarchy more than level at a time is
addressed by retracing the .. hierarchy after opening a descendant.
Opening .. isn't subject to symlink attacks so we can reliably compare
dev/ino numbers.
  • Loading branch information
the8472 committed Aug 12, 2023
1 parent 9aea939 commit 689f3d0
Show file tree
Hide file tree
Showing 2 changed files with 297 additions and 97 deletions.
1 change: 1 addition & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@
#![feature(int_roundings)]
#![feature(ip)]
#![feature(ip_in_core)]
#![feature(iter_advance_by)]
#![feature(maybe_uninit_slice)]
#![feature(maybe_uninit_uninit_array)]
#![feature(maybe_uninit_write_slice)]
Expand Down
Loading

0 comments on commit 689f3d0

Please sign in to comment.