Commit 949989e5 authored by Sergey Petrunya's avatar Sergey Petrunya

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

Don't check the value of 'role' variable in the cases where we don't need it. (it 
may be marked as unitialized and we get a runtime error).
parent f1afc003
...@@ -8645,7 +8645,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, ...@@ -8645,7 +8645,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
int elements; int elements;
const char *UNINIT_VAR(user); const char *UNINIT_VAR(user);
const char *UNINIT_VAR(host); const char *UNINIT_VAR(host);
const char *UNINIT_VAR(role); const char *role;
ACL_USER *acl_user= NULL; ACL_USER *acl_user= NULL;
ACL_ROLE *acl_role= NULL; ACL_ROLE *acl_role= NULL;
ACL_DB *acl_db= NULL; ACL_DB *acl_db= NULL;
...@@ -8795,8 +8795,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, ...@@ -8795,8 +8795,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
user= ""; user= "";
if (! host) if (! host)
host= ""; host= "";
if (! role)
role= "";
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'", DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'",
...@@ -8805,6 +8803,8 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, ...@@ -8805,6 +8803,8 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
if (struct_no == ROLES_MAPPINGS_HASH) if (struct_no == ROLES_MAPPINGS_HASH)
{ {
if (! role)
role= "";
if (user_from->is_role() ? strcmp(user_from->user.str, role) : if (user_from->is_role() ? strcmp(user_from->user.str, role) :
(strcmp(user_from->user.str, user) || (strcmp(user_from->user.str, user) ||
my_strcasecmp(system_charset_info, user_from->host.str, host))) 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