From c2854c7863aa01895febfb6503f542fce6825bd6 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 14 Oct 2019 16:45:51 +0200 Subject: MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes Data should be sent with length. --- sql/sql_show.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sql/sql_show.cc') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 0cf992ce25b..998432e8443 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2278,8 +2278,12 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) else protocol->store_null(); protocol->store(thd_info->state_info, system_charset_info); - protocol->store(thd_info->query_string.str(), - thd_info->query_string.charset()); + if (thd_info->query_string.length()) + protocol->store(thd_info->query_string.str(), + thd_info->query_string.length(), + thd_info->query_string.charset()); + else + protocol->store_null(); if (!thd->variables.old_mode && !(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO)) protocol->store(thd_info->progress, 3, &store_buffer); -- cgit v1.2.1