From e2da680c5119d78eb152394d521b898337ea5836 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 23 Jan 2018 23:19:09 +0100 Subject: MDEV-13187 incorrect backslash parsing in clients also cover USE and other built-in commands --- client/mysql.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/mysql.cc b/client/mysql.cc index 3521896c3b1..bc306c55880 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -4559,8 +4559,11 @@ static char *get_arg(char *line, get_arg_mode mode) } for (start=ptr ; *ptr; ptr++) { - if ((*ptr == '\\' && ptr[1]) || // escaped character - (!short_cmd && qtype && *ptr == qtype && ptr[1] == qtype)) // quote + /* if short_cmd use historical rules (only backslash) otherwise SQL rules */ + if (short_cmd + ? (*ptr == '\\' && ptr[1]) // escaped character + : (*ptr == '\\' && ptr[1] && qtype != '`') || // escaped character + (qtype && *ptr == qtype && ptr[1] == qtype)) // quote { // Remove (or skip) the backslash (or a second quote) if (mode != CHECK) -- cgit v1.2.1