Commit 689f3d0
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
2 files changed
+297
-97
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
| |||
0 commit comments