Skip to content

Commit

Permalink
Merge pull request #34 from mcdruid/harden_destructor
Browse files Browse the repository at this point in the history
Check _temp_tarname before deleting temp file in destructor.
  • Loading branch information
mrook authored Feb 1, 2021
2 parents 19bb8e9 + ae2bc12 commit 10db38c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Archive/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function __destruct()
{
$this->_close();
// ----- Look for a local copy to delete
if ($this->_temp_tarname != '') {
if ($this->_temp_tarname != '' && (bool) preg_match('/^tar[[:alnum:]]*\.tmp$/', $this->_temp_tarname)) {
@unlink($this->_temp_tarname);
}
}
Expand Down

0 comments on commit 10db38c

Please # to comment.