[PATCH] osl_getAbsoluteFileURL symlinks allowed: ".", ".." still treated

Lionel Elie Mamane lionel at mamane.lu
Thu Aug 4 02:42:29 PDT 2011


---
 sal/osl/unx/file_url.cxx |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 21fbe37..7caabcd 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -722,7 +722,9 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString*  ustrBaseDirURL, rtl_uString* u
         rtl::OUString base;
         sal_Int32 last_slash = unresolved_path.lastIndexOf( UNICHAR_SLASH );
 
-        if (last_slash >= 0 && last_slash + 1 < unresolved_path.getLength())
+        if (last_slash >= 0 && last_slash + 1 < unresolved_path.getLength()
+            && ! ( last_slash + 2 == unresolved_path.getLength() && unresolved_path.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("."), last_slash + 1) )
+            && ! ( last_slash + 3 == unresolved_path.getLength() && unresolved_path.matchAsciiL(RTL_CONSTASCII_STRINGPARAM(".."), last_slash + 1) ))
         {
             base = unresolved_path.copy(last_slash+1);
             unresolved_path = unresolved_path.copy(0, last_slash);
-- 
1.7.2.5


--qMm9M+Fa2AknHoGS--


More information about the LibreOffice mailing list