diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-01-23 23:19:09 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-01-24 09:35:07 +0100 |
commit | e2da680c5119d78eb152394d521b898337ea5836 (patch) | |
tree | be3d6f0c8576e670cef19a2a81532fc9eae4e1cd /client | |
parent | 8637931f118b53ff6fdadf6006ccdb8dedd6f732 (diff) | |
download | mariadb-git-e2da680c5119d78eb152394d521b898337ea5836.tar.gz |
MDEV-13187 incorrect backslash parsing in clients
also cover USE and other built-in commands
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 7 |
1 files changed, 5 insertions, 2 deletions
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) |