Skip to content

Commit 0098d78

Browse files
committed
MDEV-10465 general_log_file can be abused
Windows!
1 parent a3f6424 commit 0098d78

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

mysql-test/suite/sys_vars/r/general_log_file_basic.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ SET @@global.general_log_file = '.my.cnf';
2020
ERROR 42000: Variable 'general_log_file' can't be set to the value of '.my.cnf'
2121
SET @@global.general_log_file = 'my.cnf\0foo';
2222
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'my.cnf'
23+
SET @@global.general_log_file = 'my.ini';
24+
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'my.ini'
2325
'#----------------------FN_DYNVARS_004_03------------------------#'
2426
SELECT @@global.general_log_file = VARIABLE_VALUE
2527
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES

mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ SET @@global.general_log_file = '.my.cnf';
1717
ERROR 42000: Variable 'general_log_file' can't be set to the value of '.my.cnf'
1818
SET @@global.general_log_file = 'my.cnf\0foo';
1919
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'my.cnf'
20+
SET @@global.general_log_file = 'my.ini';
21+
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'my.ini'
2022
'#----------------------FN_DYNVARS_004_03------------------------#'
2123
SELECT @@global.slow_query_log_file = VARIABLE_VALUE
2224
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES

mysql-test/suite/sys_vars/t/general_log_file_basic.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ SET @@global.general_log_file = '/tmp/my.cnf';
6969
SET @@global.general_log_file = '.my.cnf';
7070
--error ER_WRONG_VALUE_FOR_VAR
7171
SET @@global.general_log_file = 'my.cnf\0foo';
72+
--error ER_WRONG_VALUE_FOR_VAR
73+
SET @@global.general_log_file = 'my.ini';
7274

7375

7476
--echo '#----------------------FN_DYNVARS_004_03------------------------#'

mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ SET @@global.slow_query_log_file = '/tmp/my.cnf';
6767
SET @@global.general_log_file = '.my.cnf';
6868
--error ER_WRONG_VALUE_FOR_VAR
6969
SET @@global.general_log_file = 'my.cnf\0foo';
70+
--error ER_WRONG_VALUE_FOR_VAR
71+
SET @@global.general_log_file = 'my.ini';
7072

7173
--echo '#----------------------FN_DYNVARS_004_03------------------------#'
7274
##############################################################################

sql/sys_vars.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,10 +3040,14 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var)
30403040
return true;
30413041

30423042
static const LEX_CSTRING my_cnf= { STRING_WITH_LEN("my.cnf") };
3043+
static const LEX_CSTRING my_ini= { STRING_WITH_LEN("my.ini") };
30433044
if (path_length >= my_cnf.length)
30443045
{
30453046
if (strcasecmp(path + path_length - my_cnf.length, my_cnf.str) == 0)
30463047
return true; // log file name ends with "my.cnf"
3048+
DBUG_ASSERT(my_cnf.length == my_ini.length);
3049+
if (strcasecmp(path + path_length - my_ini.length, my_ini.str) == 0)
3050+
return true; // log file name ends with "my.ini"
30473051
}
30483052

30493053
MY_STAT f_stat;

0 commit comments

Comments
 (0)