Fix #1721 add some safeguards when saving system config file

This commit is contained in:
Kijin Sung 2021-06-19 19:54:30 +09:00
parent b01a148675
commit 254634479c
3 changed files with 25 additions and 4 deletions

View file

@ -303,7 +303,7 @@ class Storage
flock($fp, \LOCK_UN);
fclose($fp);
if ($result === false)
if ($result === false || (is_string($content) && strlen($content) !== $result))
{
trigger_error('Cannot write file: ' . (isset($original_filename) ? $original_filename : $filename), \E_USER_WARNING);
return false;