summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/item.cc1
-rw-r--r--sql/sql_acl.cc1
-rw-r--r--sql/sql_parse.cc6
3 files changed, 5 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 28c234da523..f9ad1bab4f2 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1078,6 +1078,7 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
if (!cs->ctype || cs->mbminlen > 1)
{
str+= cs->cset->scan(cs, str, str + length, MY_SEQ_SPACES);
+ length-= str - str_start;
}
else
{
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 2847da9d3da..15dea349c5c 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -8868,6 +8868,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
acl_user->user.str= strdup_root(&acl_memroot, user_to->user.str);
acl_user->user.length= user_to->user.length;
acl_user->host.hostname= strdup_root(&acl_memroot, user_to->host.str);
+ acl_user->hostname_length= user_to->host.length;
break;
case DB_ACL:
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a07e5c974f4..f20c5ee9582 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4335,12 +4335,12 @@ end_with_restore_list:
case SQLCOM_SHOW_GRANTS:
{
LEX_USER *grant_user= lex->grant_user;
+ Security_context *sctx= thd->security_ctx;
if (!grant_user)
goto error;
- if (grant_user->user.str && grant_user->host.str &&
- !strcmp(thd->security_ctx->priv_user, grant_user->user.str) &&
- !strcmp(thd->security_ctx->priv_host, grant_user->host.str))
+ if (grant_user->user.str && !strcmp(sctx->priv_user, grant_user->user.str) &&
+ grant_user->host.str && !strcmp(sctx->priv_host, grant_user->host.str))
grant_user->user= current_user;
if (grant_user->user.str == current_user.str ||