diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-03-16 21:55:10 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-03-16 21:55:10 +0400 |
commit | e6f67c64cda4e4ca4f1463ae65f301358ed356a7 (patch) | |
tree | fe952ce152ae5383966b8761756cd59cdd86dc44 /sql/sql_acl.cc | |
parent | 4cb86b79dd61b51ab09811a8c5ef383a16638fc9 (diff) | |
download | mariadb-git-e6f67c64cda4e4ca4f1463ae65f301358ed356a7.tar.gz |
MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index aaa12763cec..471dd0eac91 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -11701,7 +11701,6 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio, char *passwd= strend(user)+1; uint user_len= passwd - user - 1, db_len; char *db= passwd; - char db_buff[SAFE_NAME_LEN + 1]; // buffer to store db in utf8 char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8 uint dummy_errors; @@ -11738,12 +11737,9 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio, char *client_plugin= next_field= passwd + passwd_len + (db ? db_len + 1 : 0); /* Since 4.1 all database names are stored in utf8 */ - if (db) - { - db_len= copy_and_convert(db_buff, sizeof(db_buff) - 1, system_charset_info, - db, db_len, thd->charset(), &dummy_errors); - db= db_buff; - } + if (thd->copy_with_error(system_charset_info, &mpvio->db, + thd->charset(), db, db_len)) + return packet_error; user_len= copy_and_convert(user_buff, sizeof(user_buff) - 1, system_charset_info, user, user_len, @@ -11773,8 +11769,6 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio, Security_context *sctx= thd->security_ctx; - if (thd->make_lex_string(&mpvio->db, db, db_len) == 0) - return packet_error; /* The error is set by make_lex_string(). */ my_free(sctx->user); if (!(sctx->user= my_strndup(user, user_len, MYF(MY_WME)))) return packet_error; /* The error is set by my_strdup(). */ |