Kaydet (Commit) 11b0ce9b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

cid#706201: No need to call access prior to realpath here

...and thus silence a TOCTOU warning

Change-Id: I17f36181946616747d84aca6d43e44d180dc8741
üst 0bb0522b
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment