Commit 11476cfc authored by unknown's avatar unknown

BUG#30472: libmysql doesn't reset charset, insert_id after

succ. mysql_change_user() call.

Use 2 bytes for character set number.

parent 3175946b
...@@ -736,8 +736,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, ...@@ -736,8 +736,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION) if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
{ {
*end= (uchar) mysql->charset->number; int2store(end, (ushort) mysql->charset->number);
++end; end+= 2;
} }
/* Write authentication package */ /* Write authentication package */
......
...@@ -878,10 +878,19 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -878,10 +878,19 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
} }
db_length= strlen(db); db_length= strlen(db);
char *ptr= db + db_length + 1;
uint cs_number= 0; uint cs_number= 0;
if (db + db_length < packet_end) if (ptr < packet_end)
cs_number= (uchar) *(db + db_length + 1); {
if (ptr + 2 > packet_end)
{
my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
break;
}
cs_number= uint2korr(ptr);
}
/* Convert database name to utf8 */ /* Convert database name to utf8 */
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1, db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment