From bb92d61a1b58f1e457e81bb9a6cfae3d4f1b70aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Jun 2019 10:32:02 +0300 Subject: [PATCH] Fix KILL command packet boundary detection If a packet with a KILL query was followed with another packet in the same network buffer, the code wouldn't work as it expected to receive only one packet at a time. --- .../modules/protocol/MySQL/mariadbclient/mysql_client.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index fb53c180b..67be3016a 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -1863,13 +1863,8 @@ return_rc: static spec_com_res_t process_special_commands(DCB* dcb, GWBUF* read_buffer, int nbytes_read) { spec_com_res_t rval = RES_CONTINUE; - bool is_complete = false; - unsigned int packet_len = - MYSQL_GET_PAYLOAD_LEN((uint8_t*)GWBUF_DATA(read_buffer)) + MYSQL_HEADER_LEN; - if (gwbuf_length(read_buffer) == packet_len) - { - is_complete = true; - } + unsigned int packet_len = MYSQL_GET_PAYLOAD_LEN((uint8_t*)GWBUF_DATA(read_buffer)) + MYSQL_HEADER_LEN; + bool is_complete = gwbuf_length(read_buffer) >= packet_len; /** * Handle COM_SET_OPTION. This seems to be only used by some versions of PHP.