[Libreoffice-commits] core.git: sal/osl
Mike Kaganski
mike.kaganski at collabora.com
Mon Nov 13 13:51:44 UTC 2017
sal/osl/w32/file_url.cxx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 4b334e45d570b79708ef34afba2eab78a410dab5
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Mon Nov 13 15:58:59 2017 +0300
IsValidFilePath: fix correction of double path delimiters
Wuthout this fix, it had always tried to replace in original path,
thus second occurence of double path delimiter, like in
C:\dir1\\dir2\dir3\\file
would result in invalid path reported.
Change-Id: I63ce97b620229601e18f10016a759275aceeec4d
Reviewed-on: https://gerrit.libreoffice.org/44675
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
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;
}
More information about the Libreoffice-commits
mailing list