diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2015-05-30 12:13:45 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2015-05-30 13:15:05 +0300 |
commit | 3839e91223528cb3435f48e13cf4832dfd009a84 (patch) | |
tree | 830657f21f5a8b470f6bb5088e81070d5c4d5cc8 | |
parent | ae4b24340d8f6d23ef7f4a82df3f981d65d9b060 (diff) | |
download | mariadb-git-3839e91223528cb3435f48e13cf4832dfd009a84.tar.gz |
MDEV-8248: mysqldump incorrect identifier quoting during equality comparison
Use quote_for_equal to correctly escape characters.
-rw-r--r-- | client/mysqldump.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index 267bb53775a..62515161e30 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2630,6 +2630,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, const char *insert_option; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH]; + char temp_buff[NAME_LEN*2 + 3], temp_buff2[NAME_LEN*2 + 3]; const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, " "`COLUMN_TYPE` AS `Type`, " "`IS_NULLABLE` AS `Null`, " @@ -2638,7 +2639,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, "`EXTRA` AS `Extra`, " "`COLUMN_COMMENT` AS `Comment` " "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE " - "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'"; + "TABLE_SCHEMA = %s AND TABLE_NAME = %s"; FILE *sql_file= md_result_file; int len; my_bool is_log_table; @@ -2944,7 +2945,9 @@ static uint get_table_structure(char *table, char *db, char *table_type, verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", my_progname_short, mysql_error(mysql)); - my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table); + my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, + quote_for_equal(db, temp_buff), + quote_for_equal(table, temp_buff2)); if (mysql_query_with_error_report(mysql, &result, query_buff)) DBUG_RETURN(0); |