diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/path2utl.cpp')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/path2utl.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/path2utl.cpp b/src/libs/dutil/WixToolset.DUtil/path2utl.cpp index 862a743d..d83a4578 100644 --- a/src/libs/dutil/WixToolset.DUtil/path2utl.cpp +++ b/src/libs/dutil/WixToolset.DUtil/path2utl.cpp | |||
| @@ -327,6 +327,7 @@ DAPI_(HRESULT) PathDirectoryContainsPath( | |||
| 327 | LPWSTR sczCanonicalizedPath = NULL; | 327 | LPWSTR sczCanonicalizedPath = NULL; |
| 328 | DWORD dwDefaultFlags = PATH_CANONICALIZE_APPEND_EXTENDED_PATH_PREFIX | PATH_CANONICALIZE_KEEP_UNC_ROOT; | 328 | DWORD dwDefaultFlags = PATH_CANONICALIZE_APPEND_EXTENDED_PATH_PREFIX | PATH_CANONICALIZE_KEEP_UNC_ROOT; |
| 329 | size_t cchDirectory = 0; | 329 | size_t cchDirectory = 0; |
| 330 | size_t cchPath = 0; | ||
| 330 | 331 | ||
| 331 | if (!wzDirectory || !*wzDirectory) | 332 | if (!wzDirectory || !*wzDirectory) |
| 332 | { | 333 | { |
| @@ -355,12 +356,20 @@ DAPI_(HRESULT) PathDirectoryContainsPath( | |||
| 355 | hr = ::StringCchLengthW(sczCanonicalizedDirectory, STRSAFE_MAX_CCH, &cchDirectory); | 356 | hr = ::StringCchLengthW(sczCanonicalizedDirectory, STRSAFE_MAX_CCH, &cchDirectory); |
| 356 | PathExitOnFailure(hr, "Failed to get length of canonicalized directory."); | 357 | PathExitOnFailure(hr, "Failed to get length of canonicalized directory."); |
| 357 | 358 | ||
| 359 | hr = ::StringCchLengthW(sczCanonicalizedPath, STRSAFE_MAX_CCH, &cchPath); | ||
| 360 | PathExitOnFailure(hr, "Failed to get length of canonicalized path."); | ||
| 361 | |||
| 362 | if (cchPath <= cchDirectory) | ||
| 363 | { | ||
| 364 | ExitFunction1(hr = S_FALSE); | ||
| 365 | } | ||
| 366 | |||
| 358 | if (CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, sczCanonicalizedDirectory, (DWORD)cchDirectory, sczCanonicalizedPath, (DWORD)cchDirectory)) | 367 | if (CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, sczCanonicalizedDirectory, (DWORD)cchDirectory, sczCanonicalizedPath, (DWORD)cchDirectory)) |
| 359 | { | 368 | { |
| 360 | ExitFunction1(hr = S_FALSE); | 369 | ExitFunction1(hr = S_FALSE); |
| 361 | } | 370 | } |
| 362 | 371 | ||
| 363 | hr = sczCanonicalizedPath[cchDirectory] ? S_OK : S_FALSE; | 372 | hr = S_OK; |
| 364 | 373 | ||
| 365 | LExit: | 374 | LExit: |
| 366 | ReleaseStr(sczCanonicalizedPath); | 375 | ReleaseStr(sczCanonicalizedPath); |
