From 532334cb11835d18f2705ecfd014659b4a2e8252 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Thu, 25 Sep 2014 18:27:20 +0400 Subject: [PATCH] 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). --- sql/sql_acl.cc | 6 +++--- 1 file 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)))