From fd9f3f13a3d99aa828ed9cd0625d87a9991dd486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Thu, 19 Aug 2021 21:40:54 +0200 Subject: [PATCH] Fixed 'strcat-param-overlap' found by ASAN in 'IsKeepMultiplexEnabledVariables' #3554 --- lib/mysql_connection.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index e1d6352af..699cc0d75 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -2254,7 +2254,11 @@ bool MySQL_Connection::IsKeepMultiplexEnabledVariables(char *query_digest_text) } while (query_digest_text_filter_select && (match = strcasestr(query_digest_text_filter_select,"@@"))) { *match = '\0'; - strcat(query_digest_text_filter_select, match+strlen("@@")); + if (strlen(query_digest_text_filter_select) == 0) { + memcpy(query_digest_text_filter_select, match, strlen("@@")); + } else { + strcat(query_digest_text_filter_select, match+strlen("@@")); + } } std::vectorquery_digest_text_filter_select_v;