diff options
author | Rob Mensching <rob@firegiant.com> | 2024-02-06 12:05:56 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-03-06 18:03:38 -0800 |
commit | 2824298d9dd817a47527c920363556b54ead5d5d (patch) | |
tree | f13e80ab44769f5a3f49244ca3b86b9a3d9d4535 | |
parent | ce9ef4702cddf9a2398f6fbb7702988b662b5565 (diff) | |
download | wix-2824298d9dd817a47527c920363556b54ead5d5d.tar.gz wix-2824298d9dd817a47527c920363556b54ead5d5d.tar.bz2 wix-2824298d9dd817a47527c920363556b54ead5d5d.zip |
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.
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/dirutil.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/dirutil.cpp b/src/libs/dutil/WixToolset.DUtil/dirutil.cpp index 8c7ef461..d6d782e0 100644 --- a/src/libs/dutil/WixToolset.DUtil/dirutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/dirutil.cpp | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | *******************************************************************/ | 27 | *******************************************************************/ |
28 | extern "C" BOOL DAPI DirExists( | 28 | extern "C" BOOL DAPI DirExists( |
29 | __in_z LPCWSTR wzPath, | 29 | __in_z LPCWSTR wzPath, |
30 | __out_opt DWORD *pdwAttributes | 30 | __out_opt DWORD *pdwAttributes |
31 | ) | 31 | ) |
32 | { | 32 | { |
@@ -73,7 +73,7 @@ extern "C" HRESULT DAPI DirCreateTempPath( | |||
73 | 73 | ||
74 | *******************************************************************/ | 74 | *******************************************************************/ |
75 | extern "C" HRESULT DAPI DirEnsureExists( | 75 | extern "C" HRESULT DAPI DirEnsureExists( |
76 | __in_z LPCWSTR wzPath, | 76 | __in_z LPCWSTR wzPath, |
77 | __in_opt LPSECURITY_ATTRIBUTES psa | 77 | __in_opt LPSECURITY_ATTRIBUTES psa |
78 | ) | 78 | ) |
79 | { | 79 | { |
@@ -203,8 +203,8 @@ extern "C" HRESULT DAPI DirEnsureDeleteEx( | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | // If we're deleting files and/or child directories loop through the contents of the directory. | 206 | // If we're deleting files and/or child directories loop through the contents of the directory, but skip junctions. |
207 | if (fDeleteFiles || fRecurse) | 207 | if ((fDeleteFiles || fRecurse) && (0 == (dwAttrib & FILE_ATTRIBUTE_REPARSE_POINT))) |
208 | { | 208 | { |
209 | if (fScheduleDelete) | 209 | if (fScheduleDelete) |
210 | { | 210 | { |