diff options
author | Rob Mensching <rob@firegiant.com> | 2024-02-06 12:05:56 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-02-06 12:06:10 -0800 |
commit | e30c1b2432726d2d5ba572328f9a3956c5d7389c (patch) | |
tree | 7a70a1bef398efc3f550de921afc3b360229695c | |
parent | fec38b6461d0551339139a2fe52403a61942adc0 (diff) | |
download | wix-e30c1b2432726d2d5ba572328f9a3956c5d7389c.tar.gz wix-e30c1b2432726d2d5ba572328f9a3956c5d7389c.tar.bz2 wix-e30c1b2432726d2d5ba572328f9a3956c5d7389c.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 | { |