summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-09-17 19:38:42 +0200
committerSergei Golubchik <sergii@pisem.net>2014-09-17 19:38:42 +0200
commitc338772a59c5cdfb4ab9032e482dd1b25c85d3c4 (patch)
tree5a26bf9720ee0c147cc608aa54476ad9ca278dc2 /sql/sql_parse.cc
parentb04748c8cd8604039d4e5e97bf19013b03e8283b (diff)
downloadmariadb-git-c338772a59c5cdfb4ab9032e482dd1b25c85d3c4.tar.gz
fixes for valgrind failures
sql/item.cc: don't forget to adjust the length of the string when removing leading spaces sql/sql_acl.cc: when updating the hostname of the ACL_USER, update the hostname_length too sql/sql_parse.cc: first compare the username string, then test the host pointer (host pointer is undefined when the username string is one of the hard-coded values set by the parser). This is not a bug, old code is perfectly safe as the undefined host pointer is never dereferenced, but let's keep valgrind happy.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a07e5c974f4..f20c5ee9582 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4335,12 +4335,12 @@ end_with_restore_list:
case SQLCOM_SHOW_GRANTS:
{
LEX_USER *grant_user= lex->grant_user;
+ Security_context *sctx= thd->security_ctx;
if (!grant_user)
goto error;
- if (grant_user->user.str && grant_user->host.str &&
- !strcmp(thd->security_ctx->priv_user, grant_user->user.str) &&
- !strcmp(thd->security_ctx->priv_host, grant_user->host.str))
+ if (grant_user->user.str && !strcmp(sctx->priv_user, grant_user->user.str) &&
+ grant_user->host.str && !strcmp(sctx->priv_host, grant_user->host.str))
grant_user->user= current_user;
if (grant_user->user.str == current_user.str ||