summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2014-09-25 18:27:20 +0400
committerSergei Petrunia <psergey@askmonty.org>2014-09-25 18:27:20 +0400
commit532334cb11835d18f2705ecfd014659b4a2e8252 (patch)
tree5093e184d08f0ddf644417806783b2ba04e13f80 /sql
parent9ce830d641f532a3d318b35f6c3e807c8c57d990 (diff)
downloadmariadb-git-532334cb11835d18f2705ecfd014659b4a2e8252.tar.gz
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).
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index e67a019d1f7..258522329d2 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -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)))