Fixed Binary-unsafe 'fopen(...)' usage (#84)

This commit is contained in:
Roman Kelesidis 2023-04-01 00:20:40 +07:00 committed by GitHub
parent c9bcb37222
commit 1b935b8776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -252,7 +252,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 />';
@ -441,7 +441,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 />';

View File

@ -110,7 +110,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

@ -179,7 +179,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

@ -268,7 +268,7 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
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);
} }