diff --git a/sql/auth/sql_authentication.cc b/sql/auth/sql_authentication.cc --- a/sql/auth/sql_authentication.cc +++ b/sql/auth/sql_authentication.cc @@ -2152,6 +2152,7 @@ static bool parse_com_change_user_packet(THD *thd, MPVIO_EXT *mpvio, if (ptr + 1 < end) { if (mpvio->charset_adapter->init_client_charset(uint2korr(ptr))) return true; + ptr = ptr + 2; } /* Convert database and user names to utf8 */ @@ -2189,17 +2190,17 @@ static bool parse_com_change_user_packet(THD *thd, MPVIO_EXT *mpvio, const char *client_plugin; if (protocol->has_client_capability(CLIENT_PLUGIN_AUTH)) { - client_plugin = ptr + 2; - /* - ptr needs to be updated to point to correct position so that - connection attributes are read properly. - */ - ptr = ptr + 2 + strlen(client_plugin) + 1; - + client_plugin = ptr; if (client_plugin >= end) { my_error(ER_UNKNOWN_COM_ERROR, MYF(0)); return true; } + + /* + ptr needs to be updated to point to correct position so that + connection attributes are read properly. + */ + ptr = ptr + strlen(client_plugin) + 1; } else client_plugin = Cached_authentication_plugins::get_plugin_name( PLUGIN_MYSQL_NATIVE_PASSWORD);