aboutsummaryrefslogtreecommitdiff
path: root/src/dtf
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2024-03-22 11:55:43 -0700
committerRob Mensching <rob@firegiant.com>2024-03-22 11:55:43 -0700
commite84b6768772c01e44dd55fb583cf78388ec7e48a (patch)
tree7db38898da59e2b2ec05f5ef8c2c88a39ba557ac /src/dtf
parent90cdebbe94c7f60db86965ffb97d9ba51d0bc9fc (diff)
downloadwix-e84b6768772c01e44dd55fb583cf78388ec7e48a.tar.gz
wix-e84b6768772c01e44dd55fb583cf78388ec7e48a.tar.bz2
wix-e84b6768772c01e44dd55fb583cf78388ec7e48a.zip
Don't follow junctions when recursing directories.
When deleting directories recursively, an elevated custom action following junctions in a user-writable location could recurse into any directory, including some that you might not want to be deleted. Therefore, avoid recursing into directories that are actually junctions (aka "reparse points"). This applies to: - The RemoveFoldersEx custom action (which doesn't actually do deletions but would instruct elevated MSI to delete on your behalf). - DTF's custom action runner.
Diffstat (limited to 'src/dtf')
-rw-r--r--src/dtf/SfxCA/SfxUtil.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dtf/SfxCA/SfxUtil.cpp b/src/dtf/SfxCA/SfxUtil.cpp
index 1bf2c5b2..2e6b0555 100644
--- a/src/dtf/SfxCA/SfxUtil.cpp
+++ b/src/dtf/SfxCA/SfxUtil.cpp
@@ -93,7 +93,9 @@ bool DeleteDirectory(const wchar_t* szDir)
93 StringCchCopy(szPath + cchDir + 1, cchPathBuf - (cchDir + 1), fd.cFileName); 93 StringCchCopy(szPath + cchDir + 1, cchPathBuf - (cchDir + 1), fd.cFileName);
94 if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) 94 if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
95 { 95 {
96 if (wcscmp(fd.cFileName, L".") != 0 && wcscmp(fd.cFileName, L"..") != 0) 96 if (wcscmp(fd.cFileName, L".") != 0
97 && wcscmp(fd.cFileName, L"..") != 0
98 && ((fd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) == 0))
97 { 99 {
98 DeleteDirectory(szPath); 100 DeleteDirectory(szPath);
99 } 101 }