From 896c7deb03a56ce3683b2de8757749545675a895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 23 Jul 2018 09:23:17 +0300 Subject: [PATCH] Use gwbuf_make_contiguous only with non-NULL buffers A NULL buffer should never be made contiguous as that points to a flaw in program logic. --- server/modules/protocol/MySQL/mariadbclient/mysql_client.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index 915b37d71..692f80bbb 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -1600,11 +1600,11 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF // Process client request one packet at a time packetbuf = modutil_get_next_MySQL_packet(p_readbuf); - // TODO: Do this only when RCAP_TYPE_CONTIGUOUS_INPUT is requested - packetbuf = gwbuf_make_contiguous(packetbuf); - if (packetbuf != NULL) { + // TODO: Do this only when RCAP_TYPE_CONTIGUOUS_INPUT is requested + packetbuf = gwbuf_make_contiguous(packetbuf); + CHK_GWBUF(packetbuf); MySQLProtocol* proto = (MySQLProtocol*)session->client_dcb->protocol;