summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-08-30 10:59:31 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-08-30 10:59:31 +0300
commitb260903832456dcad882e01a10cdcd48dfd2b0dc (patch)
tree19b9b9f8fa0a0450473eef5815a316754f460cd7 /sql/table.cc
parent0d1de5e1d19f1e96058ab5948e184f22e7bdd908 (diff)
downloadmariadb-git-b260903832456dcad882e01a10cdcd48dfd2b0dc.tar.gz
MDEV-29258 Failing assertion for name length on RENAME TABLE
trx_undo_page_report_rename(): Use the correct maximum length of a table name. Both the database name and the table name can be up to NAME_CHAR_LEN (64 characters) times 5 bytes per character in the my_charset_filename encoding. They are not encoded in UTF-8! fil_op_write_log(): Reserve the correct amount of log buffer for a rename operation. The file name will be appended by mlog_catenate_string(). rename_file_ext(): Reserve a large enough buffer for the file names.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 64fb3150a39..506195127b2 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2021, MariaDB
+ Copyright (c) 2008, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -4197,7 +4197,8 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
int
rename_file_ext(const char * from,const char * to,const char * ext)
{
- char from_b[FN_REFLEN],to_b[FN_REFLEN];
+ /* Reserve space for ./databasename/tablename.frm + NUL byte */
+ char from_b[2 + FN_REFLEN + 4 + 1], to_b[2 + FN_REFLEN + 4 + 1];
(void) strxmov(from_b,from,ext,NullS);
(void) strxmov(to_b,to,ext,NullS);
return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0));