1 # name : bug580324.patch
2 # introduced : 11 or before
6 # Any small change to this file in the main branch
7 # should be done or reviewed by the maintainer!
11 const TABLE_LIST *table_list,
14 - uint key_length= (uint) (strmov(strmov(key, table_list->db)+1,
15 - table_list->table_name)-key)+1;
16 + char *db_end= strnmov(key, table_list->db, MAX_DBKEY_LENGTH - 2);
18 + char *table_end= strnmov(db_end, table_list->table_name,
19 + key + MAX_DBKEY_LENGTH - 1 - db_end);
21 + uint key_length= (uint) (table_end-key);
24 int4store(key + key_length, thd->server_id);
25 --- a/sql/sql_parse.cc
26 +++ b/sql/sql_parse.cc
27 @@ -1116,11 +1116,18 @@
31 - char *fields, *packet_end= packet + packet_length, *arg_end;
33 + char *packet_end= packet + packet_length;
35 /* Locked closure of all tables */
36 TABLE_LIST table_list;
37 + char table_name_buff[NAME_LEN+1];
38 LEX_STRING table_name;
42 + table_name.str= table_name_buff;
43 + table_name.length= 0;
45 SHOW statements should not add the used tables to the list of tables
46 used in a transaction.
47 @@ -1133,24 +1140,23 @@
49 We have name + wildcard in packet, separated by endzero
51 - arg_end= strend(packet);
52 - uint arg_length= arg_end - packet;
54 - /* Check given table name length. */
55 - if (arg_length >= packet_length || arg_length > NAME_LEN)
56 + wildcard= strend(packet);
57 + table_name.length= wildcard - packet;
59 + uint query_length= (uint) (packet_end - wildcard); // Don't count end \0
60 + if (table_name.length > NAME_LEN || query_length > NAME_LEN)
62 my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
65 - thd->convert_string(&table_name, system_charset_info,
66 - packet, arg_length, thd->charset());
67 - if (check_table_name(table_name.str, table_name.length, FALSE))
69 - /* this is OK due to convert_string() null-terminating the string */
70 - my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name.str);
71 + table_name.length= copy_and_convert(table_name.str,
72 + sizeof(table_name_buff)-1,
73 + system_charset_info,
74 + packet, table_name.length,
75 + thd->charset(), &dummy_errors);
76 + table_name.str[table_name.length]= '\0';
77 + if (!(fields= (char *) thd->memdup(wildcard, query_length + 1)))
80 - packet= arg_end + 1;
81 mysql_reset_thd_for_next_command(thd);
83 /* Must be before we init the table list. */
85 table_list.schema_table= schema_table;
88 - uint query_length= (uint) (packet_end - packet); // Don't count end \0
89 - if (!(fields= (char *) thd->memdup(packet, query_length + 1)))
91 thd->set_query(fields, query_length);
92 general_log_print(thd, command, "%s %s", table_list.table_name, fields);
94 --- a/strings/ctype-utf8.c
95 +++ b/strings/ctype-utf8.c
96 @@ -4212,6 +4212,10 @@
99 char hex[]= "0123456789abcdef";
102 + return MY_CS_TOOSMALL;
104 if (wc < 128 && filename_safe_char[wc])