summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-05-01 11:47:43 +0200
committerSergei Golubchik <serg@mariadb.org>2018-05-01 11:47:43 +0200
commit42fac3241368ad72f8cfef2b8521269e6c173558 (patch)
tree1e78b735d3f9ee05c61fdfb37a1f1d044c9c9cba /sql-common
parentc4499a03917aecfc2d86142c469d02618cbec54b (diff)
parentfab383aac0a713b48765d0464428199470ae8c0a (diff)
downloadmariadb-git-42fac3241368ad72f8cfef2b8521269e6c173558.tar.gz
Merge branch '5.5' into 10.0mariadb-10.0.35
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index d583f54bcba..586c2effc1e 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1503,7 +1503,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
else
{
cur->data[field] = to;
- if (to + len > end_to)
+ if (unlikely(len > (ulong)(end_to-to) || to > end_to))
{
free_rows(result);
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)
}
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);
return -1;
@@ -2735,7 +2735,7 @@ static int client_mpvio_read_packet(struct st_plugin_vio *mpv, uchar **buf)
*buf= mysql->net.read_pos;
/* 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 */
/*
@@ -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_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,