Fix mode
This commit is contained in:
parent
a17aa5e091
commit
5ca7dee2fd
@ -487,8 +487,8 @@ class Filesystem
|
|||||||
$tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
|
$tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
|
||||||
|
|
||||||
// Use fopen instead of file_exists as some streams do not support stat
|
// 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
|
// Use mode 'x+' to atomically check existence and create to avoid a TOCTOU vulnerability
|
||||||
$handle = @fopen($tmpFile, 'x');
|
$handle = @fopen($tmpFile, 'x+');
|
||||||
|
|
||||||
// If unsuccessful restart the loop
|
// If unsuccessful restart the loop
|
||||||
if (false === $handle) {
|
if (false === $handle) {
|
||||||
|
Reference in New Issue
Block a user