From 09eb50a83e3f5f9fe1a44782c7685046a344042b Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Tue, 21 Nov 2023 13:55:07 +0500 Subject: [PATCH] Remove any trailing spaces and semicolons from the SET statement --- lib/MySQL_Session.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index d2ac2998ac..99afae7fbf 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -6032,6 +6032,8 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C string nq=string((char *)CurrentQuery.QueryPointer,CurrentQuery.QueryLength); RE2::GlobalReplace(&nq,(char *)"^/\\*!\\d\\d\\d\\d\\d SET(.*)\\*/",(char *)"SET\\1"); RE2::GlobalReplace(&nq,(char *)"(?U)/\\*.*\\*/",(char *)""); + // remove trailing space and semicolon if present. See issue#4380 + nq.erase(nq.find_last_not_of(" ;") + 1); /* // we do not threat SET SQL_LOG_BIN as a special case if (match_regexes && match_regexes[0]->match(dig)) {