summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-21 11:22:13 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-21 11:22:13 +0200
commit7af0de9fa3ef96dcd77143a9588d417522e13743 (patch)
treeaf29f7b825b7ccb886bea7c1a2b38ad9381c34f2 /extra
parent8dffaaef72feaeb06fe82c7fec9c3f6c509804fb (diff)
parent482710b20c28e2cdc598dc37468cc5dc06c53ac1 (diff)
downloadmariadb-git-7af0de9fa3ef96dcd77143a9588d417522e13743.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/backup_copy.cc3
-rw-r--r--extra/mariabackup/xtrabackup.cc21
2 files changed, 14 insertions, 10 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index d4581e6f952..39171f29a2a 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -2349,7 +2349,8 @@ static void rocksdb_copy_back() {
return;
char rocksdb_home_dir[FN_REFLEN];
if (xb_rocksdb_datadir && is_abs_path(xb_rocksdb_datadir)) {
- strncpy(rocksdb_home_dir, xb_rocksdb_datadir, sizeof(rocksdb_home_dir));
+ strncpy(rocksdb_home_dir, xb_rocksdb_datadir, sizeof rocksdb_home_dir - 1);
+ rocksdb_home_dir[sizeof rocksdb_home_dir - 1] = '\0';
} else {
snprintf(rocksdb_home_dir, sizeof(rocksdb_home_dir), "%s/%s", mysql_data_home,
xb_rocksdb_datadir?trim_dotslash(xb_rocksdb_datadir): ROCKSDB_BACKUP_DIR);
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index c903b374797..6030c1fca63 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -2552,8 +2552,9 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
goto error;
}
- strncpy(dst_name, (dest_name)?dest_name : cursor.rel_path, sizeof(dst_name));
-
+ strncpy(dst_name, dest_name ? dest_name : cursor.rel_path,
+ sizeof dst_name - 1);
+ dst_name[sizeof dst_name - 1] = '\0';
/* Setup the page write filter */
if (xtrabackup_incremental) {
@@ -2871,7 +2872,8 @@ static void dbug_mariabackup_event(const char *event,const char *key)
if (slash)
*slash = '_';
} else {
- strncpy(envvar, event, sizeof(envvar));
+ strncpy(envvar, event, sizeof envvar - 1);
+ envvar[sizeof envvar - 1] = '\0';
}
char *sql = getenv(envvar);
if (sql) {
@@ -3282,7 +3284,7 @@ static dberr_t xb_assign_undo_space_start()
byte* page;
bool ret;
dberr_t error = DB_SUCCESS;
- ulint space, page_no __attribute__((unused));
+ ulint space;
int n_retries = 5;
ulint fsp_flags;
@@ -3334,10 +3336,10 @@ retry:
/* 0th slot always points to system tablespace.
1st slot should point to first undotablespace which is minimum. */
- page_no = mach_read_ulint(TRX_SYS + TRX_SYS_RSEGS
- + TRX_SYS_RSEG_SLOT_SIZE
- + TRX_SYS_RSEG_PAGE_NO + page, MLOG_4BYTES);
- ut_ad(page_no != FIL_NULL);
+ ut_ad(mach_read_from_4(TRX_SYS + TRX_SYS_RSEGS
+ + TRX_SYS_RSEG_SLOT_SIZE
+ + TRX_SYS_RSEG_PAGE_NO + page)
+ != FIL_NULL);
space = mach_read_ulint(TRX_SYS + TRX_SYS_RSEGS
+ TRX_SYS_RSEG_SLOT_SIZE
@@ -4498,7 +4500,8 @@ void backup_fix_ddl(void)
const char *extension = is_remote ? ".isl" : ".ibd";
name.append(extension);
char buf[FN_REFLEN];
- strncpy(buf, name.c_str(), sizeof(buf));
+ strncpy(buf, name.c_str(), sizeof buf - 1);
+ buf[sizeof buf - 1] = '\0';
const char *dbname = buf;
char *p = strchr(buf, '/');
if (p == 0) {