From 3aa50f64bb129ed38cd16031ec40ae1fe3082ee4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 13 May 2013 15:49:48 +0200 Subject: [PATCH] MDEV-4505 Buffer overrun when processing --log-bin parameter without file name because --log-bin sets opt_bin_logname to "" (same for any OPT_ARG GET_STR (or GET_STR_ALLOC) option) --- sql/mysqld.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d612d920ad4..d743be03c1a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4253,11 +4253,13 @@ will be ignored as the --log-bin option is not defined."); } #endif + DBUG_ASSERT(!opt_bin_log || opt_bin_logname); + if (opt_bin_log) { /* Reports an error and aborts, if the --log-bin's path is a directory.*/ - if (opt_bin_logname && + if (opt_bin_logname[0] && opt_bin_logname[strlen(opt_bin_logname) - 1] == FN_LIBCHAR) { sql_print_error("Path '%s' is a directory name, please specify \ @@ -4279,7 +4281,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); char buf[FN_REFLEN]; const char *ln; ln= mysql_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf); - if (!opt_bin_logname && !opt_binlog_index_name) + if (!opt_bin_logname[0] && !opt_binlog_index_name) { /* User didn't give us info to name the binlog index file.