diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-04 15:52:54 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-04 15:52:54 +0200 |
commit | 5164f8c206e48c00aba2ec3007f309e3840c12eb (patch) | |
tree | d0129020d8f223a0a8d8be6d01200a52a493fd4c /extra/mariabackup/backup_copy.cc | |
parent | eb56339b6656da991aa2e25de4d6f655f0bbe213 (diff) | |
download | mariadb-git-5164f8c206e48c00aba2ec3007f309e3840c12eb.tar.gz |
Fix GCC 9.2.1 -Wstringop-truncation
dict_table_rename_in_cache(): Use strcpy() instead of strncpy(),
because they are known to be equivalent in this case (the length
of old_name was already validated).
mariabackup: Invoke strncpy() with one less than the buffer size,
and explicitly add NUL as the last byte of the buffer.
Diffstat (limited to 'extra/mariabackup/backup_copy.cc')
-rw-r--r-- | extra/mariabackup/backup_copy.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index b31edfd65c5..64fc26b6762 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -467,7 +467,7 @@ struct datafile_cur_t { { memset(rel_path, 0, sizeof rel_path); if (filename) { - strncpy(abs_path, filename, sizeof abs_path); + strncpy(abs_path, filename, sizeof abs_path - 1); abs_path[(sizeof abs_path) - 1] = 0; } else { abs_path[0] = '\0'; |