Create temporary files in a secure manner

Fixes #2395.
This commit is contained in:
micbou 2016-10-20 10:33:59 +02:00
parent f27787f263
commit c991f04905
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05
2 changed files with 6 additions and 8 deletions

View File

@ -99,6 +99,7 @@ CORE_OUTDATED_MESSAGE = (
'script. See the documentation for more details.' ) 'script. See the documentation for more details.' )
SERVER_IDLE_SUICIDE_SECONDS = 10800 # 3 hours SERVER_IDLE_SUICIDE_SECONDS = 10800 # 3 hours
DIAGNOSTIC_UI_FILETYPES = set( [ 'cpp', 'cs', 'c', 'objc', 'objcpp' ] ) DIAGNOSTIC_UI_FILETYPES = set( [ 'cpp', 'cs', 'c', 'objc', 'objcpp' ] )
LOGFILE_FORMAT = 'ycmd_{port}_{std}_'
class YouCompleteMe( object ): class YouCompleteMe( object ):
@ -143,13 +144,10 @@ class YouCompleteMe( object ):
'--idle_suicide_seconds={0}'.format( '--idle_suicide_seconds={0}'.format(
SERVER_IDLE_SUICIDE_SECONDS ) ] SERVER_IDLE_SUICIDE_SECONDS ) ]
filename_format = os.path.join( utils.PathToCreatedTempDir(), self._server_stdout = utils.CreateLogfile(
'server_{port}_{std}.log' ) LOGFILE_FORMAT.format( port = server_port, std = 'stdout' ) )
self._server_stderr = utils.CreateLogfile(
self._server_stdout = filename_format.format( port = server_port, LOGFILE_FORMAT.format( port = server_port, std = 'stderr' ) )
std = 'stdout' )
self._server_stderr = filename_format.format( port = server_port,
std = 'stderr' )
args.append( '--stdout={0}'.format( self._server_stdout ) ) args.append( '--stdout={0}'.format( self._server_stdout ) )
args.append( '--stderr={0}'.format( self._server_stderr ) ) args.append( '--stderr={0}'.format( self._server_stderr ) )

2
third_party/ycmd vendored

@ -1 +1 @@
Subproject commit 63c3d992a2db8d189cd78a25a70c87348726fc52 Subproject commit fbc28d2e17af4c843b75bb4659baaab7a23d1d9c