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!
8 diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc
9 --- a/sql/sql_base.cc 2011-01-11 21:35:26.000000000 +0300
10 +++ b/sql/sql_base.cc 2011-01-11 21:42:02.000000000 +0300
12 const TABLE_LIST *table_list,
15 - uint key_length= (uint) (strmov(strmov(key, table_list->db)+1,
16 - table_list->table_name)-key)+1;
17 + char *db_end= strnmov(key, table_list->db, MAX_DBKEY_LENGTH - 2);
19 + char *table_end= strnmov(db_end, table_list->table_name,
20 + key + MAX_DBKEY_LENGTH - 1 - db_end);
22 + uint key_length= (uint) (table_end-key);
25 int4store(key + key_length, thd->server_id);
26 diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
27 --- a/sql/sql_parse.cc 2011-01-11 21:35:26.000000000 +0300
28 +++ b/sql/sql_parse.cc 2011-01-11 21:48:50.000000000 +0300
29 @@ -1113,11 +1113,18 @@
33 - char *fields, *packet_end= packet + packet_length, *arg_end;
35 + char *packet_end= packet + packet_length;
37 /* Locked closure of all tables */
38 TABLE_LIST table_list;
39 + char table_name_buff[NAME_LEN+1];
40 LEX_STRING table_name;
44 + table_name.str= table_name_buff;
45 + table_name.length= 0;
47 SHOW statements should not add the used tables to the list of tables
48 used in a transaction.
49 @@ -1130,24 +1137,23 @@
51 We have name + wildcard in packet, separated by endzero
53 - arg_end= strend(packet);
54 - uint arg_length= arg_end - packet;
56 - /* Check given table name length. */
57 - if (arg_length >= packet_length || arg_length > NAME_LEN)
58 + wildcard= strend(packet);
59 + table_name.length= wildcard - packet;
61 + uint query_length= (uint) (packet_end - wildcard); // Don't count end \0
62 + if (table_name.length > NAME_LEN || query_length > NAME_LEN)
64 my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
67 - thd->convert_string(&table_name, system_charset_info,
68 - packet, arg_length, thd->charset());
69 - if (check_table_name(table_name.str, table_name.length, FALSE))
71 - /* this is OK due to convert_string() null-terminating the string */
72 - my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name.str);
73 + table_name.length= copy_and_convert(table_name.str,
74 + sizeof(table_name_buff)-1,
75 + system_charset_info,
76 + packet, table_name.length,
77 + thd->charset(), &dummy_errors);
78 + table_name.str[table_name.length]= '\0';
79 + if (!(fields= (char *) thd->memdup(wildcard, query_length + 1)))
82 - packet= arg_end + 1;
83 mysql_reset_thd_for_next_command(thd);
85 /* Must be before we init the table list. */
87 table_list.schema_table= schema_table;
90 - uint query_length= (uint) (packet_end - packet); // Don't count end \0
91 - if (!(fields= (char *) thd->memdup(packet, query_length + 1)))
93 thd->set_query(fields, query_length);
94 general_log_print(thd, command, "%s %s", table_list.table_name, fields);
96 diff -ruN a/strings/ctype-utf8.c b/strings/ctype-utf8.c
97 --- a/strings/ctype-utf8.c 2010-12-03 20:58:26.000000000 +0300
98 +++ b/strings/ctype-utf8.c 2011-01-11 21:42:02.000000000 +0300
99 @@ -4212,6 +4212,10 @@
102 char hex[]= "0123456789abcdef";
105 + return MY_CS_TOOSMALL;
107 if (wc < 128 && filename_safe_char[wc])