Skip to content

Commit

Permalink
Do not follow junctions when recursively deleting directories
Browse files Browse the repository at this point in the history
This will prevent elevated processes from accidentally following a junction
from a user-writable directory to a per-machine directory and erroneously
deleting the per-machine contents.
  • Loading branch information
robmen committed Feb 6, 2024
1 parent ea94ed0 commit cb77605
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libs/dutil/dirutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ extern "C" HRESULT DAPI DirEnsureDeleteEx(
}
}

// If we're deleting files and/or child directories loop through the contents of the directory.
if (fDeleteFiles || fRecurse)
// If we're deleting files and/or child directories loop through the contents of the directory, but skip junctions.
if ((fDeleteFiles || fRecurse) && (0 == (dwAttrib & FILE_ATTRIBUTE_REPARSE_POINT)))
{
if (fScheduleDelete)
{
Expand Down

0 comments on commit cb77605

Please sign in to comment.