From 3caf3cc323cd25b002aa8e44d871d4677da7a029 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 15 May 2012 10:54:18 -0700 Subject: Harden installer against bad characters in the database name or prefix. Fixes #1866. --- installer/web.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'installer/web.php') diff --git a/installer/web.php b/installer/web.php index 6102f0e0..12f42d02 100644 --- a/installer/web.php +++ b/installer/web.php @@ -39,6 +39,13 @@ if (installer::already_installed()) { "prefix" => $_POST["prefix"], "type" => function_exists("mysqli_set_charset") ? "mysqli" : "mysql"); list ($config["host"], $config["port"]) = explode(":", $config["host"] . ":"); + foreach ($config as $k => $v) { + if ($k == "password") { + $config[$k] = str_replace("'", "\\'", $v); + } else { + $config[$k] = strtr($v, "'`", "__"); + } + } if (!installer::connect($config)) { $content = render("invalid_db_info.html.php"); -- cgit v1.2.3