summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorSivert Sorumgard <sivert.sorumgaard@oracle.com>2016-08-22 14:30:02 +0200
committerSivert Sorumgard <sivert.sorumgaard@oracle.com>2016-08-24 13:41:08 +0200
commit8dc642112c83c73969f37dbb12b9fe8f546fd42a (patch)
tree98ddc1f86d386149a2a9541ca190e10b99764619 /sql/mysqld.cc
parent033b11912121ad2c1dbd4a93202eeac196124801 (diff)
downloadmariadb-git-8dc642112c83c73969f37dbb12b9fe8f546fd42a.tar.gz
Bug#24388753: PRIVILEGE ESCALATION USING MYSQLD_SAFE
[This is the 5.5/5.6 version of the bugfix]. The problem was that it was possible to write log files ending in .ini/.cnf that later could be parsed as an options file. This made it possible for users to specify startup options without the permissions to do so. This patch fixes the problem by disallowing general query log and slow query log to be written to files ending in .ini and .cnf.
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index a2532ceddd3..e979ea1b731 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights
+/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights
reserved.
This program is free software; you can redistribute it and/or modify
@@ -3512,6 +3512,22 @@ static int init_common_variables()
"--log-slow-queries option, log tables are used. "
"To enable logging to files use the --log-output=file option.");
+ if (opt_logname &&
+ !is_valid_log_name(opt_logname, strlen(opt_logname)))
+ {
+ sql_print_error("Invalid value for --general_log_file: %s",
+ opt_logname);
+ return 1;
+ }
+
+ if (opt_slow_logname &&
+ !is_valid_log_name(opt_slow_logname, strlen(opt_slow_logname)))
+ {
+ sql_print_error("Invalid value for --slow_query_log_file: %s",
+ opt_slow_logname);
+ return 1;
+ }
+
#define FIX_LOG_VAR(VAR, ALT) \
if (!VAR || !*VAR) \
{ \