mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
client/mysqldump.c: fixed typo include/mysql_com.h: added new constants SYSTEM_CHARSET_MBMAXLEN, NAME_CHAR_LEN, USERNAME_CHAR_LENGTH increased NAME_LEN, USERNAME_LENGTH mysql-test/r/create.result: result fix mysql-test/r/grant.result: result fix mysql-test/r/mysql.result: result fix mysql-test/r/sp.result: result fix mysql-test/t/create.test: test case mysql-test/t/grant.test: test case sql/events.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/item_strfunc.h: fixed calculation of max_length sql/mysql_priv.h: check_string_length function is replaced with check_string_byte_length added new function check_string_char_length sql/sp.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/sp_head.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/sp_head.h: changed parameter of 'check_routine_name' function sql/sql_class.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/share/errmsg.txt: increased argument lengths according to new constants sql/sql_parse.cc: removed unnecessary checks added function 'check_string_char_length' sql/sql_plugin.cc: check that name is not longer than NAME_CHAR_LEN symbols sql/sql_show.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/sql_table.cc: check that key name is not longer than NAME_LEN symbols sql/sql_udf.cc: check that udf name is not longer than NAME_CHAR_LEN symbols sql/sql_yacc.yy: check that user name is not longer than USERNAME_CHAR_LENGTH symbols sql/table.cc: check that db or table or column name is not longer than NAME_LEN symbols storage/innobase/handler/ha_innodb.cc: removed unnecessary multiplication tests/mysql_client_test.c: NAME_LEN is replaced with NAME_CHAR_LEN
This commit is contained in:
@ -2541,6 +2541,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
{
|
||||
DBUG_PRINT("info", ("key name: '%s' type: %d", key->name ? key->name :
|
||||
"(none)" , key->type));
|
||||
LEX_STRING key_name_str;
|
||||
if (key->type == Key::FOREIGN_KEY)
|
||||
{
|
||||
fk_key_count++;
|
||||
@ -2562,7 +2563,10 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
my_error(ER_TOO_MANY_KEY_PARTS,MYF(0),tmp);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (key->name && strlen(key->name) > NAME_LEN)
|
||||
key_name_str.str= (char*) key->name;
|
||||
key_name_str.length= key->name ? strlen(key->name) : 0;
|
||||
if (check_string_char_length(&key_name_str, "", NAME_CHAR_LEN,
|
||||
system_charset_info, 1))
|
||||
{
|
||||
my_error(ER_TOO_LONG_IDENT, MYF(0), key->name);
|
||||
DBUG_RETURN(-1);
|
||||
@ -4049,7 +4053,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
|
||||
if (end_active_trans(thd))
|
||||
DBUG_RETURN(1);
|
||||
field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
|
||||
field_list.push_back(item = new Item_empty_string("Table", NAME_CHAR_LEN*2));
|
||||
item->maybe_null = 1;
|
||||
field_list.push_back(item = new Item_empty_string("Op", 10));
|
||||
item->maybe_null = 1;
|
||||
@ -4631,7 +4635,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
|
||||
/*
|
||||
Validate the source table
|
||||
*/
|
||||
if (table_ident->table.length > NAME_LEN ||
|
||||
if (check_string_char_length(&table_ident->table, "", NAME_CHAR_LEN,
|
||||
system_charset_info, 1) ||
|
||||
(table_ident->table.length &&
|
||||
check_table_name(src_table,table_ident->table.length)))
|
||||
{
|
||||
|
Reference in New Issue
Block a user