diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-03-07 08:02:33 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-03-07 08:02:33 +0200 |
commit | aa4b2c15093312784ab3e21493d3093fd5bddbb1 (patch) | |
tree | df334024af7ae992af183d5d205e62edd1e258b8 /extra | |
parent | 32badae31f852e327c0cb9a1aabb936ccf13dd37 (diff) | |
parent | f0cd70750345755fafaf095daaf7f861815f8600 (diff) | |
download | mariadb-git-aa4b2c15093312784ab3e21493d3093fd5bddbb1.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'extra')
-rw-r--r-- | extra/mariabackup/backup_copy.cc | 3 | ||||
-rw-r--r-- | extra/mariabackup/encryption_plugin.cc | 8 | ||||
-rw-r--r-- | extra/mariabackup/fil_cur.cc | 6 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 9 |
4 files changed, 17 insertions, 9 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 5e529e665e1..d4581e6f952 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -512,7 +512,8 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n) 5.6+. We want to make "local" copies for the backup. */ strncpy(cursor->rel_path, xb_get_relative_path(cursor->abs_path, FALSE), - sizeof(cursor->rel_path)); + (sizeof cursor->rel_path) - 1); + cursor->rel_path[(sizeof cursor->rel_path) - 1] = '\0'; cursor->file = os_file_create_simple_no_error_handling( 0, cursor->abs_path, diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc index 505ae69af7b..a3242078293 100644 --- a/extra/mariabackup/encryption_plugin.cc +++ b/extra/mariabackup/encryption_plugin.cc @@ -123,7 +123,8 @@ void encryption_plugin_backup_init(MYSQL *mysql) /* Required to load the plugin later.*/ add_to_plugin_load_list(plugin_load.c_str()); - strncpy(opt_plugin_dir, dir, FN_REFLEN); + strncpy(opt_plugin_dir, dir, FN_REFLEN - 1); + opt_plugin_dir[FN_REFLEN - 1] = '\0'; oss << "plugin_dir=" << '"' << dir << '"' << std::endl; @@ -193,7 +194,10 @@ void encryption_plugin_prepare_init(int argc, char **argv) add_to_plugin_load_list(plugin_load.c_str()); if (xb_plugin_dir) - strncpy(opt_plugin_dir, xb_plugin_dir, FN_REFLEN); + { + strncpy(opt_plugin_dir, xb_plugin_dir, FN_REFLEN - 1); + opt_plugin_dir[FN_REFLEN - 1] = '\0'; + } char **new_argv = new char *[argc + 1]; new_argv[0] = XTRABACKUP_EXE; diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index ff187182dca..9678fcf5775 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -147,7 +147,8 @@ xb_fil_cur_open( cursor->space_id = node->space->id; - strncpy(cursor->abs_path, node->name, sizeof(cursor->abs_path)); + strncpy(cursor->abs_path, node->name, (sizeof cursor->abs_path) - 1); + cursor->abs_path[(sizeof cursor->abs_path) - 1] = '\0'; /* Get the relative path for the destination tablespace name, i.e. the one that can be appended to the backup root directory. Non-system @@ -155,7 +156,8 @@ xb_fil_cur_open( We want to make "local" copies for the backup. */ strncpy(cursor->rel_path, xb_get_relative_path(cursor->abs_path, cursor->is_system()), - sizeof(cursor->rel_path)); + (sizeof cursor->rel_path) - 1); + cursor->rel_path[(sizeof cursor->rel_path) - 1] = '\0'; /* In the backup mode we should already have a tablespace handle created by fil_ibd_load() unless it is a system diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 6213558bcb2..296163978dc 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -2406,8 +2406,9 @@ check_if_skip_table( return(FALSE); } - strncpy(buf, dbname, FN_REFLEN); - buf[tbname - 1 - dbname] = 0; + strncpy(buf, dbname, FN_REFLEN - 1); + buf[FN_REFLEN - 1] = '\0'; + buf[tbname - 1 - dbname] = '\0'; const skip_database_check_result skip_database = check_if_skip_database(buf); @@ -2415,7 +2416,6 @@ check_if_skip_table( return (TRUE); } - buf[FN_REFLEN - 1] = '\0'; buf[tbname - 1 - dbname] = '.'; /* Check if there's a suffix in the table name. If so, truncate it. We @@ -4857,7 +4857,8 @@ xtrabackup_apply_delta( } dst_path[strlen(dst_path) - 6] = '\0'; - strncpy(space_name, filename, FN_REFLEN); + strncpy(space_name, filename, FN_REFLEN - 1); + space_name[FN_REFLEN - 1] = '\0'; space_name[strlen(space_name) - 6] = 0; if (!get_meta_path(src_path, meta_path)) { |