Skip to content

Commit

Permalink
MDEV-11505 wrong databasename in mysqldump comment
Browse files Browse the repository at this point in the history
fix_for_comment() uses a static buffer. cannot have two
fix_for_comment() calls as arguments to one printf().
  • Loading branch information
vuvova committed Feb 27, 2017
1 parent d72dbb4 commit 4453448
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/mysqldump.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,9 @@ static void write_header(FILE *sql_file, char *db_name)
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
fix_for_comment(current_host ? current_host : "localhost"),
print_comment(sql_file, 0, "-- Host: %s ",
fix_for_comment(current_host ? current_host : "localhost"));
print_comment(sql_file, 0, "Database: %s\n",
fix_for_comment(db_name ? db_name : ""));
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"
Expand Down
8 changes: 8 additions & 0 deletions mysql-test/t/mysqldump.test
Original file line number Diff line number Diff line change
Expand Up @@ -2509,3 +2509,11 @@ if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Wind
}
--exec $MYSQL_DUMP --routines --compact $shell_ready_db_name
DROP DATABASE `a\"'``b`;

#"
# MDEV-11505 wrong databasename in mysqldump comment
#
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/bug11505.sql;
let SEARCH_PATTERN=Database: mysql;
exec $MYSQL_DUMP mysql func > $SEARCH_FILE;
source include/search_pattern_in_file.inc;

0 comments on commit 4453448

Please sign in to comment.