Commit ca9293b3 authored by Steven Wittens's avatar Steven Wittens
Browse files

#54981: calls to db_lock_table in bootstrap.inc do not use db_prefix

parent b1762700
......@@ -315,6 +315,15 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $
return $query;
}
/**
* Restrict a dynamic tablename to safe characters.
*
* Only keeps alphanumeric and underscores.
*/
function db_escape_table($string) {
return preg_replace('/[^A-Za-z0-9_]+/', '', $string);
}
/**
* @} End of "defgroup database".
*/
......
......@@ -353,7 +353,7 @@ function db_escape_string($text) {
* Lock a table.
*/
function db_lock_table($table) {
db_query('LOCK TABLES {%s} WRITE', $table);
db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
}
/**
......
......@@ -355,7 +355,7 @@ function db_escape_string($text) {
* Lock a table.
*/
function db_lock_table($table) {
db_query('LOCK TABLES {%s} WRITE', $table);
db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
}
/**
......
......@@ -331,7 +331,7 @@ function db_escape_string($text) {
* This function automatically starts a transaction.
*/
function db_lock_table($table) {
db_query('BEGIN; LOCK TABLE {%s} IN EXCLUSIVE MODE', $table);
db_query('BEGIN; LOCK TABLE {'. db_escape_table($table) .'} IN EXCLUSIVE MODE');
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment