mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Avoid Arbitrary File Deletion abuse via Object Injection
This commit is contained in:
parent
a1e583f657
commit
dd75c9ddab
|
|
@ -201,7 +201,7 @@ class FileCache extends AbstractCache
|
|||
|
||||
try {
|
||||
if ($this->tmp === null) {
|
||||
$this->tmp = $this->directory . uniqid('', true);
|
||||
$this->tmp = $this->directory . uniqid(__CLASS__, true);
|
||||
}
|
||||
|
||||
file_put_contents($this->tmp, $data);
|
||||
|
|
@ -259,7 +259,7 @@ class FileCache extends AbstractCache
|
|||
#[\ReturnTypeWillChange]
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->tmp !== null && file_exists($this->tmp)) {
|
||||
if ($this->tmp !== null && (strpos(basename($this->tmp), __CLASS__) === 0) && file_exists($this->tmp)) {
|
||||
unlink($this->tmp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user