Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit cb77605

Browse files
committed
Do not follow junctions when recursively deleting directories
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.
1 parent ea94ed0 commit cb77605

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libs/dutil/dirutil.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ extern "C" HRESULT DAPI DirEnsureDeleteEx(
210210
}
211211
}
212212

213-
// If we're deleting files and/or child directories loop through the contents of the directory.
214-
if (fDeleteFiles || fRecurse)
213+
// If we're deleting files and/or child directories loop through the contents of the directory, but skip junctions.
214+
if ((fDeleteFiles || fRecurse) && (0 == (dwAttrib & FILE_ATTRIBUTE_REPARSE_POINT)))
215215
{
216216
if (fScheduleDelete)
217217
{

0 commit comments

Comments
 (0)