diff options
-rw-r--r-- | sal/osl/w32/file_url.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index 568abf19fd7c..d25fd9b56d71 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -270,13 +270,15 @@ DWORD IsValidFilePath(rtl_uString *path, DWORD dwFlags, rtl_uString **corrected) } /* Now validate each component of the path */ + rtl_uString * lastCorrected = path; while ( bValid && lpComponent ) { // Correct path by merging consecutive slashes: if (*lpComponent == '\\' && corrected != nullptr) { sal_Int32 i = lpComponent - lpszPath; - rtl_uString_newReplaceStrAt(corrected, path, i, 1, nullptr); + rtl_uString_newReplaceStrAt(corrected, lastCorrected, i, 1, nullptr); //TODO: handle out-of-memory + lastCorrected = *corrected; lpszPath = (*corrected)->buffer; lpComponent = lpszPath + i; } |