From 8a69232e2601f6c0957e14917747cdd18a2109c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 10 Oct 2017 21:32:10 +0300 Subject: [PATCH] Fix usage of partial packets when full packets are expected The authentication phase expects full packets. If the packets aren't complete a debug assertion would get hit. To detect this, the result of the extracted buffer needs to be checked. --- server/modules/protocol/MySQL/MySQLClient/mysql_client.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.cc b/server/modules/protocol/MySQL/MySQLClient/mysql_client.cc index 14ef09c08..58591ea1b 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.cc +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.cc @@ -494,12 +494,12 @@ int gw_read_client_event(DCB* dcb) dcb_readq_set(dcb, read_buffer); if (nbytes_read < 3 || (0 == max_bytes && nbytes_read < (int)(MYSQL_GET_PAYLOAD_LEN((uint8_t *) GWBUF_DATA(read_buffer)) + 4)) || - (0 != max_bytes && nbytes_read < max_bytes)) + (0 != max_bytes && nbytes_read < max_bytes) || + (read_buffer = modutil_get_next_MySQL_packet(&dcb->readq)) == NULL) { return 0; } - read_buffer = modutil_get_next_MySQL_packet(&dcb->readq); ss_dassert(read_buffer); nbytes_read = gwbuf_length(read_buffer);