Skip to content

Commit

Permalink
Fixes for install page and invalid settings of cachedir
Browse files Browse the repository at this point in the history
  • Loading branch information
craigk5n committed Sep 13, 2023
1 parent f947a5c commit 55b1648
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/formvars.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function preventHacking ( $name, $instr ) {
// CSRF protection can be disabled in Admin Settings, but
// the tokens are still added to forms.
if (empty($CSRF_PROTECTION) || $CSRF_PROTECTION != 'N') {
if (empty($_REQUEST['csrf_form_key'])) {
if (empty($_REQUEST['csrf_form_key']) || empty($_SESSION['csrf_form_key'])) {
die_miserable_death (translate('Fatal Error') . ': '
. translate('Invalid form request'));
}
Expand Down
9 changes: 8 additions & 1 deletion install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,13 @@
echo "Bugger off.<br>";
exit;
}
foreach ($settings as $k => $v) {
// Don't allow someone to put start/end PHP tags in settings.php
if (preg_match('/<\?(php)?|(\?>)/', $v)) {
echo "Bugger off.<br>";
exit;
}
}
$fd = @fopen($file, 'w+b', false);

if (empty($fd))
Expand All @@ -775,7 +782,7 @@
if ($v != '<br>' && $v != '')
fwrite($fd, $k . ': ' . $v . "\r\n");
}
fwrite($fd, "# end settings.php */\r\n?\>\r\n");
fwrite($fd, "# end settings.php */\r\n?>\r\n");
fclose($fd);

if ($post_action != $testSettingsStr && $post_action2 != $createNewStr)
Expand Down

0 comments on commit 55b1648

Please sign in to comment.