[Libreoffice-commits] core.git: 2 commits - cppuhelper/source cppu/source
Stephan Bergmann
sbergman at redhat.com
Tue Nov 18 03:17:48 PST 2014
cppu/source/typelib/typelib.cxx | 1 +
cppuhelper/source/findsofficepath.c | 29 ++++++++++++-----------------
2 files changed, 13 insertions(+), 17 deletions(-)
New commits:
commit 6d2e4740a5fbfe8cbf1157a439b73e1bf177c071
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 18 12:15:02 2014 +0100
Assert that typelib_typedescription_release will not destroy pTDR->pType
...which is dereferenced a few lines further down; this is in preparation for a
commit addressing cid#440589.
Change-Id: I3428216258d928473f85ecd4d025c352c8c83ea0
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 7f3e808..392f012 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -1556,6 +1556,7 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_register(
else if( !pTDR->pType->bOnDemand && (*ppNewDescription)->bOnDemand )
{
// switch from !OnDemand to OnDemand, so the description must be relesed
+ assert(pTDR->pType->nRefCount > 1);
typelib_typedescription_release( pTDR->pType );
}
commit 11b0ce9bab436eec81534e9a82bfe76e69b0cf41
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 18 11:26:15 2014 +0100
cid#706201: No need to call access prior to realpath here
...and thus silence a TOCTOU warning
Change-Id: I17f36181946616747d84aca6d43e44d180dc8741
diff --git a/cppuhelper/source/findsofficepath.c b/cppuhelper/source/findsofficepath.c
index f062d8f..37c8bdf 100644
--- a/cppuhelper/source/findsofficepath.c
+++ b/cppuhelper/source/findsofficepath.c
@@ -156,26 +156,21 @@ static char* platformSpecific(void)
strcpy( file, dir );
strcat( file, APPENDIX );
- /* check existence of soffice file */
- if ( !access( file, F_OK ) )
+ /* resolve symbolic link */
+ resolved = realpath( file, buffer );
+ if ( resolved != NULL )
{
- /* resolve symbolic link */
- resolved = realpath( file, buffer );
+ /* get path to program directory */
+ sep = strrchr( resolved, SEPARATOR );
- if ( resolved != NULL )
+ if ( sep != NULL )
{
- /* get path to program directory */
- sep = strrchr( resolved, SEPARATOR );
-
- if ( sep != NULL )
- {
- pos = sep - resolved;
- path = (char*) malloc( pos + 1 );
- strncpy( path, resolved, pos );
- path[ pos ] = '\0';
- free( file );
- break;
- }
+ pos = sep - resolved;
+ path = (char*) malloc( pos + 1 );
+ strncpy( path, resolved, pos );
+ path[ pos ] = '\0';
+ free( file );
+ break;
}
}
More information about the Libreoffice-commits
mailing list