summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 66fae0bed10..4f2c10c37ef 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2345,9 +2345,16 @@ bool Item_func_current_role::fix_fields(THD *thd, Item **ref)
Security_context *ctx= context->security_ctx
? context->security_ctx : thd->security_ctx;
- const char *role= ctx->priv_role[0] ? ctx->priv_role : NONE_ROLE;
+ LEX_STRING role;
+ if (ctx->priv_role[0])
+ {
+ role.str= ctx->priv_role;
+ role.length= strlen(role.str);
+ }
+ else
+ role= none_role;
- if (str_value.copy(role, strlen(role), system_charset_info))
+ if (str_value.copy(role.str, role.length, system_charset_info))
return 1;
str_value.mark_as_const();