mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-15 03:02:39 -04:00
Harden installer against bad characters in the database name or prefix. Fixes #1866.
This commit is contained in:
@@ -65,14 +65,14 @@ abstract class Database extends Database_Core {
|
||||
$open_brace = strpos($sql, "TO {") + 4;
|
||||
$close_brace = strpos($sql, "}", $open_brace);
|
||||
$name = substr($sql, $open_brace, $close_brace - $open_brace);
|
||||
$this->_table_names["{{$name}}"] = "{$prefix}$name";
|
||||
$this->_table_names["{{$name}}"] = "`{$prefix}$name`";
|
||||
}
|
||||
|
||||
if (!isset($this->_table_names)) {
|
||||
// This should only run once on the first query
|
||||
$this->_table_names = array();
|
||||
foreach($this->list_tables() as $table_name) {
|
||||
$this->_table_names["{{$table_name}}"] = $prefix . $table_name;
|
||||
$this->_table_names["{{$table_name}}"] = "`{$prefix}{$table_name}`";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user