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.
This commit is contained in:
Markus Mäkelä 2017-10-10 21:32:10 +03:00
parent c3627c83be
commit 8a69232e26

View File

@ -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);