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 /storage | |
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 'storage')
-rw-r--r-- | storage/innobase/dict/dict0dict.cc | 6 | ||||
-rw-r--r-- | storage/xtradb/dict/dict0dict.cc | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index f9295e74d7c..6bd5de85b08 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -1850,8 +1850,7 @@ dict_table_rename_in_cache( /* The old table name in my_charset_filename is stored in old_name_cs_filename */ - strncpy(old_name_cs_filename, old_name, - MAX_FULL_NAME_LEN); + strcpy(old_name_cs_filename, old_name); old_name_cs_filename[MAX_FULL_NAME_LEN] = '\0'; if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) { @@ -1873,8 +1872,7 @@ dict_table_rename_in_cache( } else { /* Old name already in my_charset_filename */ - strncpy(old_name_cs_filename, old_name, - MAX_FULL_NAME_LEN); + strcpy(old_name_cs_filename, old_name); old_name_cs_filename[MAX_FULL_NAME_LEN] = '\0'; } diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc index 73e4fe6bb5b..2bea154749f 100644 --- a/storage/xtradb/dict/dict0dict.cc +++ b/storage/xtradb/dict/dict0dict.cc @@ -1856,8 +1856,7 @@ dict_table_rename_in_cache( /* The old table name in my_charset_filename is stored in old_name_cs_filename */ - strncpy(old_name_cs_filename, old_name, - MAX_FULL_NAME_LEN); + strcpy(old_name_cs_filename, old_name); old_name_cs_filename[MAX_FULL_NAME_LEN] = '\0'; if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) { @@ -1879,8 +1878,7 @@ dict_table_rename_in_cache( } else { /* Old name already in my_charset_filename */ - strncpy(old_name_cs_filename, old_name, - MAX_FULL_NAME_LEN); + strcpy(old_name_cs_filename, old_name); old_name_cs_filename[MAX_FULL_NAME_LEN] = '\0'; } |