From 5ca7dee2fd024681da037b9a3ec3f3c8c2c34f8c Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 19 Oct 2015 10:45:30 +0200 Subject: [PATCH] Fix mode --- src/Symfony/Component/Filesystem/Filesystem.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index ff2a66746c..7b19706e6c 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -487,8 +487,8 @@ class Filesystem $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true); // Use fopen instead of file_exists as some streams do not support stat - // Use mode 'x' to atomically check existence and create to avoid a TOCTOU vulnerability - $handle = @fopen($tmpFile, 'x'); + // Use mode 'x+' to atomically check existence and create to avoid a TOCTOU vulnerability + $handle = @fopen($tmpFile, 'x+'); // If unsuccessful restart the loop if (false === $handle) {