Commit 532334cb authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-6788: The variable 'role' is being used without being initialized at sql_acl.cc:8840

[Re-commit in git]
Don't check the value of 'role' variable in the cases where we don't need
it. (it may be marked as uninitialized and we get a runtime error).
parent 9ce830d6
......@@ -8687,7 +8687,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
int elements;
const char *UNINIT_VAR(user);
const char *UNINIT_VAR(host);
const char *UNINIT_VAR(role);
const char *role;
ACL_USER *acl_user= NULL;
ACL_ROLE *acl_role= NULL;
ACL_DB *acl_db= NULL;
......@@ -8837,8 +8837,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
user= "";
if (! host)
host= "";
if (! role)
role= "";
#ifdef EXTRA_DEBUG
DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'",
......@@ -8847,6 +8845,8 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
if (struct_no == ROLES_MAPPINGS_HASH)
{
if (! role)
role= "";
if (user_from->is_role() ? strcmp(user_from->user.str, role) :
(strcmp(user_from->user.str, user) ||
my_strcasecmp(system_charset_info, user_from->host.str, host)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment