[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sal/osl

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 16 11:03:58 PST 2013


 sal/osl/w32/file_dirvol.cxx |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

New commits:
commit bcc204783bf5539570af2bbb49ac0b3f337ae70d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jan 16 17:19:10 2013 +0100

    fdo#58415: Don't ignore osl_getFileURLFromSystemPath failure
    
    ...in osl_getFileStatus et al, it would leave the relevant status string member
    unchanged (i.e., a null pointer) but would mark it as valid, so that later code
    to retrieve the allegedly valid string member would crash upon the null pointer.
    
    Change-Id: Ia8528f5dc27d94f3d14a2c416955a041b87863d3
    (cherry picked from commit 588997f0ebc5696574680098b128e66eff54f00c)
    Reviewed-on: https://gerrit.libreoffice.org/1720
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 47309a4..c8c2da3 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -1523,8 +1523,10 @@ oslFileError SAL_CALL osl_getVolumeInformation(
 
     if (uFieldMask & osl_VolumeInfo_Mask_DeviceHandle)
     {
+        error = osl_getFileURLFromSystemPath(volume_root.pData, (rtl_uString**)&pInfo->pDeviceHandle);
+        if (error != osl_File_E_None)
+            return error;
         pInfo->uValidFields |= osl_VolumeInfo_Mask_DeviceHandle;
-        osl_getFileURLFromSystemPath(volume_root.pData, (rtl_uString**)&pInfo->pDeviceHandle);
     }
 
     return osl_File_E_None;
@@ -1620,8 +1622,10 @@ static oslFileError SAL_CALL osl_getDriveInfo(
         rtl_uString *ustrSystemPath = NULL;
 
         rtl_uString_newFromStr( &ustrSystemPath, reinterpret_cast<const sal_Unicode*>(pItemImpl->cDriveString) );
-        osl_getFileURLFromSystemPath( ustrSystemPath, &pStatus->ustrFileURL );
+        oslFileError error = osl_getFileURLFromSystemPath( ustrSystemPath, &pStatus->ustrFileURL );
         rtl_uString_release( ustrSystemPath );
+        if (error != osl_File_E_None)
+            return error;
         pStatus->uValidFields |= osl_FileStatus_Mask_FileURL;
     }
     return osl_File_E_None;
@@ -1649,7 +1653,9 @@ static oslFileError SAL_CALL osl_getServerInfo(
 
     if ( uFieldMask & osl_FileStatus_Mask_FileURL )
     {
-        osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrFileURL );
+        oslFileError error = osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrFileURL );
+        if (error != osl_File_E_None)
+            return error;
         pStatus->uValidFields |= osl_FileStatus_Mask_FileURL;
     }
     return osl_File_E_None;
@@ -1738,7 +1744,9 @@ oslFileError SAL_CALL osl_getFileStatus(
 
     if ( uFieldMask & osl_FileStatus_Mask_LinkTargetURL )
     {
-        osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrLinkTargetURL );
+        oslFileError error = osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrLinkTargetURL );
+        if (error != osl_File_E_None)
+            return error;
 
         pStatus->uValidFields |= osl_FileStatus_Mask_LinkTargetURL;
     }
@@ -1760,7 +1768,9 @@ oslFileError SAL_CALL osl_getFileStatus(
             }
         }
 
-        osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrFileURL );
+        oslFileError error = osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrFileURL );
+        if (error != osl_File_E_None)
+            return error;
         pStatus->uValidFields |= osl_FileStatus_Mask_FileURL;
     }
 


More information about the Libreoffice-commits mailing list