Binary-unsafe 'fopen(...)' usage

(cherry picked from commit b9686af)
This commit is contained in:
Yuriy Pikhtarev 2017-05-05 00:47:38 +03:00 committed by Vasily Komrakov
commit 7e29eb925f
No known key found for this signature in database
GPG key ID: 558236680C20A69A
4 changed files with 5 additions and 5 deletions

View file

@ -220,7 +220,7 @@ if ($check_upload) {
} }
if (!$error) { if (!$error) {
if (!($fp = @fopen($upload_dir . '/0_000000.000', 'w'))) { if (!($fp = @fopen($upload_dir . '/0_000000.000', 'wb'))) {
$error = true; $error = true;
$error_msg = sprintf($lang['DIRECTORY_NOT_WRITEABLE'], $attach_config['upload_dir']) . '<br />'; $error_msg = sprintf($lang['DIRECTORY_NOT_WRITEABLE'], $attach_config['upload_dir']) . '<br />';
} else { } else {
@ -375,7 +375,7 @@ if ($check_image_cat) {
} }
if (!$error) { if (!$error) {
if (!($fp = @fopen($upload_dir . '/0_000000.000', 'w'))) { if (!($fp = @fopen($upload_dir . '/0_000000.000', 'wb'))) {
$error = true; $error = true;
$error_msg = sprintf($lang['DIRECTORY_NOT_WRITEABLE'], $upload_dir) . '<br />'; $error_msg = sprintf($lang['DIRECTORY_NOT_WRITEABLE'], $upload_dir) . '<br />';
} else { } else {

View file

@ -130,7 +130,7 @@ class emailer
} }
} }
if (!($fd = @fopen($tpl_file, 'r'))) { if (!($fd = @fopen($tpl_file, 'rb'))) {
bb_die('Failed opening template file :: ' . $tpl_file); bb_die('Failed opening template file :: ' . $tpl_file);
} }

View file

@ -211,7 +211,7 @@ function create_atom($file_path, $mode, $id, $title, $topics)
} }
$atom .= "</feed>"; $atom .= "</feed>";
@unlink($file_path); @unlink($file_path);
$fp = fopen($file_path, "w"); $fp = fopen($file_path, 'wb');
fwrite($fp, $atom); fwrite($fp, $atom);
fclose($fp); fclose($fp);
return true; return true;

View file

@ -286,7 +286,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
if ($bb_cfg['bt_disable_dht']) { if ($bb_cfg['bt_disable_dht']) {
$tor['info']['private'] = (int)1; $tor['info']['private'] = (int)1;
$fp = fopen($filename, 'w+'); $fp = fopen($filename, 'wb+');
fwrite($fp, bencode($tor)); fwrite($fp, bencode($tor));
fclose($fp); fclose($fp);
} }