From c991f04905a2c0ffa8db7d59266bc89b4f154a46 Mon Sep 17 00:00:00 2001 From: micbou Date: Thu, 20 Oct 2016 10:33:59 +0200 Subject: [PATCH] Create temporary files in a secure manner Fixes #2395. --- python/ycm/youcompleteme.py | 12 +++++------- third_party/ycmd | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 6acfe520..cc60e3a8 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -99,6 +99,7 @@ CORE_OUTDATED_MESSAGE = ( 'script. See the documentation for more details.' ) SERVER_IDLE_SUICIDE_SECONDS = 10800 # 3 hours DIAGNOSTIC_UI_FILETYPES = set( [ 'cpp', 'cs', 'c', 'objc', 'objcpp' ] ) +LOGFILE_FORMAT = 'ycmd_{port}_{std}_' class YouCompleteMe( object ): @@ -143,13 +144,10 @@ class YouCompleteMe( object ): '--idle_suicide_seconds={0}'.format( SERVER_IDLE_SUICIDE_SECONDS ) ] - filename_format = os.path.join( utils.PathToCreatedTempDir(), - 'server_{port}_{std}.log' ) - - self._server_stdout = filename_format.format( port = server_port, - std = 'stdout' ) - self._server_stderr = filename_format.format( port = server_port, - std = 'stderr' ) + self._server_stdout = utils.CreateLogfile( + LOGFILE_FORMAT.format( port = server_port, std = 'stdout' ) ) + self._server_stderr = utils.CreateLogfile( + LOGFILE_FORMAT.format( port = server_port, std = 'stderr' ) ) args.append( '--stdout={0}'.format( self._server_stdout ) ) args.append( '--stderr={0}'.format( self._server_stderr ) ) diff --git a/third_party/ycmd b/third_party/ycmd index 63c3d992..fbc28d2e 160000 --- a/third_party/ycmd +++ b/third_party/ycmd @@ -1 +1 @@ -Subproject commit 63c3d992a2db8d189cd78a25a70c87348726fc52 +Subproject commit fbc28d2e17af4c843b75bb4659baaab7a23d1d9c