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

This commit is contained in:
Yuriy Pikhtarev 2017-05-05 00:47:38 +03:00
parent e9585e0789
commit b9686af593
No known key found for this signature in database
GPG key ID: 3A9B5A757B48ECC6
4 changed files with 5 additions and 5 deletions

View file

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

View file

@ -211,7 +211,7 @@ function create_atom($file_path, $mode, $id, $title, $topics)
}
$atom .= "</feed>";
@unlink($file_path);
$fp = fopen($file_path, "w");
$fp = fopen($file_path, 'wb');
fwrite($fp, $atom);
fclose($fp);
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']) {
$tor['info']['private'] = (int)1;
$fp = fopen($filename, 'w+');
$fp = fopen($filename, 'wb+');
fwrite($fp, bencode($tor));
fclose($fp);
}