diff options
author | Alexander Barkov <bar@mariadb.com> | 2023-04-05 15:42:27 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2023-04-05 16:16:19 +0400 |
commit | 62e137d4d739fcba6810a66242175230e8170727 (patch) | |
tree | 3d277e4400c735ff13f84870fd09d808b7311d8e /client | |
parent | afdf19cf3303bf3797fe47e5cef398227134cc32 (diff) | |
parent | 06393cd8f81e6c9a01e9ae1c8783a7f6dac21fbd (diff) | |
download | mariadb-git-62e137d4d739fcba6810a66242175230e8170727.tar.gz |
Merge remote-tracking branch 'origin/10.4' into 10.5
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 08e18be3f1b..9fa1b1dafe9 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3815,9 +3815,21 @@ void do_move_file(struct st_command *command) sizeof(move_file_args)/sizeof(struct command_arg), ' '); - if (bad_path(ds_to_file.str)) - DBUG_VOID_RETURN; + size_t from_plen = strlen(ds_from_file.str); + size_t to_plen = strlen(ds_to_file.str); + const char *vardir= getenv("MYSQLTEST_VARDIR"); + const char *tmpdir= getenv("MYSQL_TMP_DIR"); + if (!((is_sub_path(ds_from_file.str, from_plen, vardir) && + is_sub_path(ds_to_file.str, to_plen, vardir)) || + (is_sub_path(ds_from_file.str, from_plen, tmpdir) && + is_sub_path(ds_to_file.str, to_plen, tmpdir)))) { + report_or_die("Paths '%s' and '%s' are not both under MYSQLTEST_VARDIR '%s'" + "or both under MYSQL_TMP_DIR '%s'", + ds_from_file, ds_to_file, vardir, tmpdir); + DBUG_VOID_RETURN; + } + DBUG_PRINT("info", ("Move %s to %s", ds_from_file.str, ds_to_file.str)); error= (my_rename(ds_from_file.str, ds_to_file.str, MYF(disable_warnings ? 0 : MY_WME)) != 0); |