Fixed rwsplit length calculations for multi-statements

The calculations used the amount of bytes read instead of amount of bytes
available and also read one byte too much.
This commit is contained in:
Markus Makela 2016-03-04 09:54:17 +02:00
parent d1837e0e4a
commit dd9f7fbbb7

View File

@ -5368,9 +5368,9 @@ static void check_for_multi_stmt(ROUTER_CLIENT_SES* rses, GWBUF *buf,
if ((ptr = strnchr_esc_mysql(data, ';', buflen)))
{
/** Skip stored procedures etc. */
while (ptr && is_mysql_sp_end(ptr, ptr - data))
while (ptr && is_mysql_sp_end(ptr, buflen - (ptr - data)))
{
ptr = strnchr_esc_mysql(ptr + 1, ';', ptr - data);
ptr = strnchr_esc_mysql(ptr + 1, ';', buflen - (ptr - data) - 1);
}
if (ptr)