Commit 7f554deb authored by anozdrin/alik@station's avatar anozdrin/alik@station

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

succ. mysql_change_user() call.

Use 2 bytes for character set number.
parent 0635a75f
......@@ -736,8 +736,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
{
*end= (uchar) mysql->charset->number;
++end;
int2store(end, (ushort) mysql->charset->number);
end+= 2;
}
/* Write authentication package */
......
......@@ -878,10 +878,19 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
db_length= strlen(db);
char *ptr= db + db_length + 1;
uint cs_number= 0;
if (db + db_length < packet_end)
cs_number= (uchar) *(db + db_length + 1);
if (ptr < packet_end)
{
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 */
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