Skip to content

Commit 689f3d0

Browse files
committed
refactor recursive deletion into a struct maintaining the dir stack
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.
1 parent 9aea939 commit 689f3d0

File tree

2 files changed

+297
-97
lines changed

2 files changed

+297
-97
lines changed

library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@
296296
#![feature(int_roundings)]
297297
#![feature(ip)]
298298
#![feature(ip_in_core)]
299+
#![feature(iter_advance_by)]
299300
#![feature(maybe_uninit_slice)]
300301
#![feature(maybe_uninit_uninit_array)]
301302
#![feature(maybe_uninit_write_slice)]

0 commit comments

Comments
 (0)