Commit 42fac324 authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch '5.5' into 10.0

parents c4499a03 fab383aa
set @old_dbug=@@global.debug_dbug;
set global debug_dbug='+d,auth_disconnect';
create user 'bad' identified by 'worse';
set global debug_dbug=@old_dbug;
drop user bad;
source include/have_debug.inc;
set @old_dbug=@@global.debug_dbug;
#
# use after free if need plugin change and auth aborted
#
set global debug_dbug='+d,auth_disconnect';
create user 'bad' identified by 'worse';
--error 1
--exec $MYSQL --default-auth=mysql_old_password --user=bad --password=worse
set global debug_dbug=@old_dbug;
drop user bad;
...@@ -1503,7 +1503,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, ...@@ -1503,7 +1503,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
else else
{ {
cur->data[field] = to; cur->data[field] = to;
if (to + len > end_to) if (unlikely(len > (ulong)(end_to-to) || to > end_to))
{ {
free_rows(result); free_rows(result);
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate); set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
...@@ -1575,7 +1575,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) ...@@ -1575,7 +1575,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
} }
else else
{ {
if (pos + len > end_pos) if (unlikely(len > (ulong)(end_pos - pos) || pos > end_pos))
{ {
set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate); set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
return -1; return -1;
...@@ -2735,7 +2735,7 @@ static int client_mpvio_read_packet(struct st_plugin_vio *mpv, uchar **buf) ...@@ -2735,7 +2735,7 @@ static int client_mpvio_read_packet(struct st_plugin_vio *mpv, uchar **buf)
*buf= mysql->net.read_pos; *buf= mysql->net.read_pos;
/* was it a request to change plugins ? */ /* was it a request to change plugins ? */
if (**buf == 254) if (pkt_len == packet_error || **buf == 254)
return (int)packet_error; /* if yes, this plugin shan't continue */ return (int)packet_error; /* if yes, this plugin shan't continue */
/* /*
...@@ -2920,7 +2920,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len, ...@@ -2920,7 +2920,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
compile_time_assert(CR_OK == -1); compile_time_assert(CR_OK == -1);
compile_time_assert(CR_ERROR == 0); compile_time_assert(CR_ERROR == 0);
if (res > CR_OK && mysql->net.read_pos[0] != 254) if (res > CR_OK && (mysql->net.last_errno || mysql->net.read_pos[0] != 254))
{ {
/* /*
the plugin returned an error. write it down in mysql, the plugin returned an error. write it down in mysql,
......
...@@ -11172,6 +11172,7 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio, ...@@ -11172,6 +11172,7 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
const char *client_auth_plugin= const char *client_auth_plugin=
((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin; ((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin;
DBUG_EXECUTE_IF("auth_disconnect", { vio_close(net->vio); DBUG_RETURN(1); });
DBUG_ASSERT(client_auth_plugin); DBUG_ASSERT(client_auth_plugin);
/* /*
......
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