summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-06 15:15:59 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-06 15:15:59 +0200
commitc155946c90307ba448af8b4b5161f35b8af9d31d (patch)
tree426b59a490b7ec839a9465b5730ba57d0defc8f8 /extra
parent90f09ba8c249e23e015ce9d1d56463869f1a5358 (diff)
parent26f0d72a3f9b92574b16fc0348f79f16ed8021d0 (diff)
downloadmariadb-git-c155946c90307ba448af8b4b5161f35b8af9d31d.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/backup_copy.cc6
-rw-r--r--extra/mariabackup/encryption_plugin.cc8
-rw-r--r--extra/mariabackup/fil_cur.cc6
-rw-r--r--extra/mariabackup/xtrabackup.cc9
4 files changed, 18 insertions, 11 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 0059ae5b16a..be99d49a86f 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -513,7 +513,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,
@@ -646,8 +647,7 @@ mkdirp(const char *pathname, int Flags, myf MyFlags)
/* make a parent directory path */
if (!(parent= (char *)malloc(len)))
return(-1);
- strncpy(parent, pathname, len);
- parent[len-1]= 0;
+ memcpy(parent, pathname, len);
for (p = parent + strlen(parent);
!is_path_separator(*p) && p != parent; p--) ;
diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc
index be530d63ee2..8f1978e967a 100644
--- a/extra/mariabackup/encryption_plugin.cc
+++ b/extra/mariabackup/encryption_plugin.cc
@@ -107,7 +107,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;
@@ -177,7 +178,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 fa9dcb29317..fd5e1bc02dd 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -148,7 +148,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
@@ -156,7 +157,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 96537e3de42..5737fcfca64 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -2408,8 +2408,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);
@@ -2417,7 +2418,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
@@ -4888,7 +4888,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)) {