summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-07-02 15:13:37 +0200
committerSergei Golubchik <serg@mariadb.org>2021-07-02 19:21:51 +0200
commit7c02e8717de59af16e0f24a2334d10b426909c3a (patch)
treeb0ae9ba272e33e9fa0113e7c23ad633cbd7b61f1 /sql/sql_acl.cc
parentffe744e77d02737e57c5f9a2e9383ce7dbc15096 (diff)
downloadmariadb-git-7c02e8717de59af16e0f24a2334d10b426909c3a.tar.gz
MDEV-26081 set role crashes when a hostname cannot be resolved
host can be NULL
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 2b59a82277e..2d91254435a 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2732,7 +2732,6 @@ end:
my_error(ER_INVALID_ROLE, MYF(0), rolename);
break;
case 1:
- StringBuffer<1024> c_usr;
LEX_CSTRING role_lex;
/* First, check if current user can see mysql database. */
bool read_access= !check_access(thd, SELECT_ACL, "mysql", NULL, NULL, 1, 1);
@@ -2753,11 +2752,9 @@ end:
NULL) == -1))
{
/* Role is not granted but current user can see the role */
- c_usr.append(user, strlen(user));
- c_usr.append('@');
- c_usr.append(host, strlen(host));
- my_printf_error(ER_INVALID_ROLE, "User %`s has not been granted role %`s",
- MYF(0), c_usr.c_ptr(), rolename);
+ my_printf_error(ER_INVALID_ROLE, "User %`s@%`s has not been granted role %`s",
+ MYF(0), thd->security_ctx->priv_user,
+ thd->security_ctx->priv_host, rolename);
}
else
{